26
26
import java .util .concurrent .Callable ;
27
27
28
28
import org .junit .FixMethodOrder ;
29
- import org .junit .Test ;
29
+ import org .junit .jupiter . api . Test ;
30
30
import org .junit .runners .MethodSorters ;
31
31
import org .slf4j .Logger ;
32
32
import org .slf4j .LoggerFactory ;
@@ -172,7 +172,7 @@ void assumeHugeFileExists() throws IOException {
172
172
ContractTestUtils .assertPathExists (fs , "huge file not created" , hugefile );
173
173
FileStatus status = fs .getFileStatus (hugefile );
174
174
ContractTestUtils .assertIsFile (hugefile , status );
175
- assertTrue ("File " + hugefile + " is empty" , status . getLen () > 0 );
175
+ assertTrue (status . getLen () > 0 , "File " + hugefile + " is empty" );
176
176
}
177
177
178
178
/**
@@ -299,12 +299,12 @@ private void verifyConsistentReads(FSDataInputStream inputStreamV1,
299
299
byte [] bufferV2 ) throws IOException {
300
300
int size = bufferV1 .length ;
301
301
final int numBytesReadV1 = inputStreamV1 .read (bufferV1 , 0 , size );
302
- assertEquals ("Bytes read from V1 stream" , size , numBytesReadV1 );
302
+ assertEquals (size , numBytesReadV1 , "Bytes read from V1 stream" );
303
303
304
304
final int numBytesReadV2 = inputStreamV2 .read (bufferV2 , 0 , size );
305
- assertEquals ("Bytes read from V2 stream" , size , numBytesReadV2 );
305
+ assertEquals (size , numBytesReadV2 , "Bytes read from V2 stream" );
306
306
307
- assertArrayEquals ("Mismatch in read data" , bufferV1 , bufferV2 );
307
+ assertArrayEquals (bufferV1 , bufferV2 , "Mismatch in read data" );
308
308
}
309
309
310
310
@ Test
@@ -348,18 +348,18 @@ private void verifyConsistentReads(FSDataInputStream inputStreamV1,
348
348
throws IOException {
349
349
int size = bufferV1 .length ;
350
350
int numBytesReadV1 = inputStreamV1 .read (pos , bufferV1 , 0 , size );
351
- assertEquals ("Bytes read from V1 stream" , size , numBytesReadV1 );
351
+ assertEquals (size , numBytesReadV1 , "Bytes read from V1 stream" );
352
352
353
353
int numBytesReadV2 = inputStreamV2 .read (pos , bufferV2 , 0 , size );
354
- assertEquals ("Bytes read from V2 stream" , size , numBytesReadV2 );
354
+ assertEquals (size , numBytesReadV2 , "Bytes read from V2 stream" );
355
355
356
356
int numBytesReadV2NoBuffer = inputStreamV2NoBuffer .read (pos ,
357
357
bufferV2NoBuffer , 0 , size );
358
- assertEquals ("Bytes read from V2 stream (buffered pread disabled)" , size ,
359
- numBytesReadV2NoBuffer );
358
+ assertEquals (size
359
+ , numBytesReadV2NoBuffer , "Bytes read from V2 stream (buffered pread disabled)" );
360
360
361
- assertArrayEquals ("Mismatch in read data" , bufferV1 , bufferV2 );
362
- assertArrayEquals ("Mismatch in read data" , bufferV2 , bufferV2NoBuffer );
361
+ assertArrayEquals (bufferV1 , bufferV2 , "Mismatch in read data" );
362
+ assertArrayEquals (bufferV2 , bufferV2NoBuffer , "Mismatch in read data" );
363
363
}
364
364
365
365
/**
@@ -383,7 +383,7 @@ public void test_0302_MarkSupportedV2() throws IOException {
383
383
private void validateMarkSupported (FileSystem fs ) throws IOException {
384
384
assumeHugeFileExists ();
385
385
try (FSDataInputStream inputStream = fs .open (TEST_FILE_PATH )) {
386
- assertTrue ("mark is not supported" , inputStream . markSupported () );
386
+ assertTrue (inputStream . markSupported (), "mark is not supported" );
387
387
}
388
388
}
389
389
@@ -417,7 +417,7 @@ private void validateMarkAndReset(FileSystem fs) throws Exception {
417
417
assertEquals (buffer .length , bytesRead );
418
418
419
419
inputStream .reset ();
420
- assertEquals ("rest -> pos 0" , 0 , inputStream . getPos () );
420
+ assertEquals (0 , inputStream . getPos (), "rest -> pos 0" );
421
421
422
422
inputStream .mark (8 * KILOBYTE - 1 );
423
423
@@ -511,10 +511,10 @@ public Long call() throws Exception {
511
511
);
512
512
long elapsedTimeMs = timer .elapsedTimeMs ();
513
513
assertTrue (
514
- String .format (
514
+
515
+ elapsedTimeMs < 20 , String .format (
515
516
"There should not be any network I/O (elapsedTimeMs=%1$d)." ,
516
- elapsedTimeMs ),
517
- elapsedTimeMs < 20 );
517
+ elapsedTimeMs ));
518
518
}
519
519
}
520
520
@@ -559,7 +559,7 @@ public FSDataInputStream call() throws Exception {
559
559
}
560
560
);
561
561
562
- assertTrue ("Test file length only " + testFileLength , testFileLength > 0 );
562
+ assertTrue (testFileLength > 0 , "Test file length only " + testFileLength );
563
563
inputStream .seek (testFileLength );
564
564
assertEquals (testFileLength , inputStream .getPos ());
565
565
@@ -576,10 +576,10 @@ public FSDataInputStream call() throws Exception {
576
576
577
577
long elapsedTimeMs = timer .elapsedTimeMs ();
578
578
assertTrue (
579
- String .format (
579
+
580
+ elapsedTimeMs < 20 , String .format (
580
581
"There should not be any network I/O (elapsedTimeMs=%1$d)." ,
581
- elapsedTimeMs ),
582
- elapsedTimeMs < 20 );
582
+ elapsedTimeMs ));
583
583
}
584
584
}
585
585
@@ -770,13 +770,13 @@ public void test_0315_SequentialReadPerformance() throws IOException {
770
770
(long ) v2ElapsedMs ,
771
771
ratio ));
772
772
}
773
- assertTrue (String .format (
773
+ assertTrue (
774
+ ratio < maxAcceptableRatio , String .format (
774
775
"Performance of version 2 is not acceptable: v1ElapsedMs=%1$d,"
775
776
+ " v2ElapsedMs=%2$d, ratio=%3$.2f" ,
776
777
(long ) v1ElapsedMs ,
777
778
(long ) v2ElapsedMs ,
778
- ratio ),
779
- ratio < maxAcceptableRatio );
779
+ ratio ));
780
780
}
781
781
782
782
/**
@@ -804,14 +804,14 @@ public void test_0316_SequentialReadAfterReverseSeekPerformanceV2()
804
804
(long ) afterSeekElapsedMs ,
805
805
ratio ));
806
806
}
807
- assertTrue (String .format (
807
+ assertTrue (
808
+ ratio < maxAcceptableRatio , String .format (
808
809
"Performance of version 2 after reverse seek is not acceptable:"
809
810
+ " beforeSeekElapsedMs=%1$d, afterSeekElapsedMs=%2$d,"
810
811
+ " ratio=%3$.2f" ,
811
812
(long ) beforeSeekElapsedMs ,
812
813
(long ) afterSeekElapsedMs ,
813
- ratio ),
814
- ratio < maxAcceptableRatio );
814
+ ratio ));
815
815
}
816
816
817
817
private long sequentialRead (int version ,
@@ -871,13 +871,13 @@ public void test_0317_RandomReadPerformance() throws IOException {
871
871
(long ) v2ElapsedMs ,
872
872
ratio ));
873
873
}
874
- assertTrue (String .format (
874
+ assertTrue (
875
+ ratio < maxAcceptableRatio , String .format (
875
876
"Performance of version 2 is not acceptable: v1ElapsedMs=%1$d,"
876
877
+ " v2ElapsedMs=%2$d, ratio=%3$.2f" ,
877
878
(long ) v1ElapsedMs ,
878
879
(long ) v2ElapsedMs ,
879
- ratio ),
880
- ratio < maxAcceptableRatio );
880
+ ratio ));
881
881
}
882
882
883
883
private long randomRead (int version , FileSystem fs ) throws IOException {
0 commit comments