diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-08-11 21:19:39 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-08-11 21:19:39 +0000 |
commit | 9435133c1fe4ef65ec1d9fe1b9d90677b76bbcfe (patch) | |
tree | 7f6fa87d653b183821126df3e5ef4ded313b4db5 /fileacquirer/src | |
parent | a9775442179fd17067cd351051d803920c0d74fc (diff) |
Stick to junit for simple test.
Diffstat (limited to 'fileacquirer/src')
-rw-r--r-- | fileacquirer/src/test/java/MockFileAcquirerTest.java | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/fileacquirer/src/test/java/MockFileAcquirerTest.java b/fileacquirer/src/test/java/MockFileAcquirerTest.java index b03c3f6ed3d..4b48bffe24b 100644 --- a/fileacquirer/src/test/java/MockFileAcquirerTest.java +++ b/fileacquirer/src/test/java/MockFileAcquirerTest.java @@ -1,17 +1,18 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. import com.yahoo.config.FileReference; - -import com.yahoo.filedistribution.fileacquirer.*; +import com.yahoo.filedistribution.fileacquirer.FileAcquirer; +import com.yahoo.filedistribution.fileacquirer.FileReferenceDoesNotExistException; +import com.yahoo.filedistribution.fileacquirer.MockFileAcquirer; +import com.yahoo.filedistribution.fileacquirer.TimeoutException; +import org.junit.Test; import java.io.File; import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; import java.util.HashMap; -import java.util.Map; import java.util.concurrent.TimeUnit; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertEquals; + /** * Test of public API of MockFileAcquirer, since it is intended to be used by 3rd parties. @@ -19,14 +20,13 @@ import static org.junit.Assert.assertThat; * @author Tony Vaagenes */ public class MockFileAcquirerTest { - @org.junit.Test + @Test public void testReturnFile() throws Exception { File file = new File("/test"); - assertThat(waitFor(MockFileAcquirer.returnFile(file)), - equalTo(file)); + assertEquals(file, waitFor(MockFileAcquirer.returnFile(file))); } - @org.junit.Test + @Test public void testReturnFiles() throws Exception { File file1 = new File("/test1"); File file2 = new File("/test2"); @@ -37,18 +37,16 @@ public class MockFileAcquirerTest { FileAcquirer fileAcquirer = MockFileAcquirer.returnFiles(map); - assertThat(waitFor(fileAcquirer, createFileReference("1")), - equalTo(file1)); - assertThat(waitFor(fileAcquirer, createFileReference("2")), - equalTo(file2)); + assertEquals(file1, waitFor(fileAcquirer, createFileReference("1"))); + assertEquals(file2, waitFor(fileAcquirer, createFileReference("2"))); } - @org.junit.Test(expected = TimeoutException.class) + @Test(expected = TimeoutException.class) public void testThrowTimeoutException() throws Exception { waitFor(MockFileAcquirer.throwTimeoutException()); } - @org.junit.Test(expected = FileReferenceDoesNotExistException.class) + @Test(expected = FileReferenceDoesNotExistException.class) public void testThrowFileReferenceDoesNotExistException() throws Exception { waitFor(MockFileAcquirer.throwFileReferenceDoesNotExistException()); } |