2323import org .apache .hadoop .fs .Path ;
2424import org .apache .hadoop .fs .contract .ContractTestUtils ;
2525import org .apache .hadoop .io .IOUtils ;
26- import org .junit .*;
26+ import org .junit .jupiter .api .AfterEach ;
27+ import org .junit .jupiter .api .BeforeEach ;
28+ import org .junit .jupiter .api .Disabled ;
29+ import org .junit .jupiter .api .Test ;
2730import org .slf4j .Logger ;
2831import org .slf4j .LoggerFactory ;
2932
30- import static org .junit .Assert .assertTrue ;
33+ import static org .junit .jupiter . api . Assertions .assertTrue ;
3134
3235import java .io .IOException ;
3336import java .util .Random ;
@@ -43,15 +46,15 @@ public class TestCosNInputStream {
4346
4447 private Path testRootDir ;
4548
46- @ Before
49+ @ BeforeEach
4750 public void setUp () throws IOException {
4851 Configuration configuration = new Configuration ();
4952 this .fs = CosNTestUtils .createTestFileSystem (configuration );
5053 this .testRootDir = CosNTestUtils .createTestPath (new Path ("/test" ));
5154 LOG .info ("test root dir: " + this .testRootDir );
5255 }
5356
54- @ After
57+ @ AfterEach
5558 public void tearDown () throws IOException {
5659 if (null != this .fs ) {
5760 this .fs .delete (this .testRootDir , true );
@@ -76,9 +79,9 @@ public void testSeek() throws Exception {
7679 for (int i = 0 ; i != seekTimes ; i ++) {
7780 long pos = fileSize / (seekTimes - i ) - 1 ;
7881 inputStream .seek (pos );
79- assertTrue ("expected position at: " +
80- pos + ", but got : " + inputStream . getPos (),
81- inputStream .getPos () == pos );
82+ assertTrue (inputStream . getPos () == pos ,
83+ "expected position at : " +
84+ pos + ", but got: " + inputStream .getPos ());
8285 LOG .info ("completed seeking at pos: " + inputStream .getPos ());
8386 }
8487 LOG .info ("begin to random position seeking test..." );
@@ -87,9 +90,9 @@ public void testSeek() throws Exception {
8790 long pos = Math .abs (random .nextLong ()) % fileSize ;
8891 LOG .info ("seeking for pos: " + pos );
8992 inputStream .seek (pos );
90- assertTrue ("expected position at: " +
91- pos + ", but got : " + inputStream . getPos (),
92- inputStream .getPos () == pos );
93+ assertTrue (inputStream . getPos () == pos ,
94+ "expected position at : " +
95+ pos + ", but got: " + inputStream .getPos ());
9396 LOG .info ("completed seeking at pos: " + inputStream .getPos ());
9497 }
9598 }
@@ -110,16 +113,16 @@ public void testGetPos() throws Exception {
110113 Random random = new Random ();
111114 long pos = Math .abs (random .nextLong ()) % fileSize ;
112115 inputStream .seek (pos );
113- assertTrue ("expected position at: " +
114- pos + ", but got : " + inputStream . getPos (),
115- inputStream .getPos () == pos );
116+ assertTrue (inputStream . getPos () == pos ,
117+ "expected position at : " +
118+ pos + ", but got: " + inputStream .getPos ());
116119 LOG .info ("completed get pos tests." );
117120 }
118121
119122 /**
120123 * Method: seekToNewSource(long targetPos).
121124 */
122- @ Ignore ("Not ready yet" )
125+ @ Disabled ("Not ready yet" )
123126 public void testSeekToNewSource () throws Exception {
124127 LOG .info ("Currently it is not supported to " +
125128 "seek the offset in a new source." );
@@ -154,8 +157,9 @@ public void testRead() throws Exception {
154157
155158 if (bytesRead % (1 * Unit .MB ) == 0 ) {
156159 int available = inputStream .available ();
157- assertTrue ("expected remaining: " + (fileSize - bytesRead ) +
158- " but got: " + available , (fileSize - bytesRead ) == available );
160+ assertTrue ((fileSize - bytesRead ) == available ,
161+ "expected remaining: " + (fileSize - bytesRead ) +
162+ " but got: " + available );
159163 LOG .info ("Bytes read: " +
160164 Math .round ((double ) bytesRead / Unit .MB ) + "MB" );
161165 }
0 commit comments