6565
6666import static com .amazonaws .SDKGlobalConfiguration .DISABLE_CERT_CHECKING_SYSTEM_PROPERTY ;
6767import static com .github .tomakehurst .wiremock .client .WireMock .aResponse ;
68- import static org .hamcrest .MatcherAssert .assertThat ;
69- import static org .hamcrest .Matchers .containsInAnyOrder ;
70- import static org .junit .jupiter .api .Assertions .assertEquals ;
71- import static org .junit .jupiter .api .Assertions .assertTrue ;
68+ import static org .assertj .core .api .Assertions .assertThat ;
7269
7370@ Testcontainers
7471final class IntegrationTest implements IntegrationBase {
@@ -166,7 +163,7 @@ void basicTest(final String compression, final TestInfo testInfo)
166163 getOldBlobName (topicName , 2 , 0 , compression ),
167164 getOldBlobName (topicName , 3 , 0 , compression ));
168165 for (final String blobName : expectedBlobs ) {
169- assertTrue (testBucketAccessor .doesObjectExist (blobName ));
166+ assertThat (testBucketAccessor .doesObjectExist (blobName )). isTrue ( );
170167 }
171168
172169 final Map <String , List <String >> blobContents = new HashMap <>();
@@ -180,9 +177,8 @@ void basicTest(final String compression, final TestInfo testInfo)
180177
181178 for (final KeyValueMessage msg : new KeyValueGenerator (4 , 10 , keyGen , valueGen )) {
182179 final String blobName = getOldBlobName (topicName , msg .partition , 0 , compression );
183- final String actualLine = blobContents .get (blobName ).get (msg .epoch );
184- final String expectedLine = msg .key + "," + msg .value ;
185- assertEquals (expectedLine , actualLine );
180+
181+ assertThat (blobContents .get (blobName ).get (msg .epoch )).isEqualTo (msg .key + "," + msg .value );
186182 }
187183 }
188184
@@ -234,16 +230,15 @@ void groupByTimestampVariable(final String compression, final TestInfo testInfo)
234230 final List <String > expectedBlobs =
235231 expectedBlobsAndContent .keySet ().stream ().sorted ().collect (Collectors .toList ());
236232 for (final String blobName : expectedBlobs ) {
237- assertTrue (testBucketAccessor .doesObjectExist (blobName ));
233+ assertThat (testBucketAccessor .doesObjectExist (blobName )). isTrue ( );
238234 }
239235
240236 for (final String blobName : expectedBlobs ) {
241237 final List <String > blobContent =
242238 testBucketAccessor .readAndDecodeLines (blobName , compression , 0 , 1 ).stream ()
243239 .map (fields -> String .join ("," , fields ))
244240 .collect (Collectors .toList ());
245- assertThat (blobContent , containsInAnyOrder (expectedBlobsAndContent .get (blobName )));
246-
241+ assertThat (blobContent ).containsExactlyInAnyOrder (expectedBlobsAndContent .get (blobName ));
247242 }
248243 }
249244
@@ -300,14 +295,12 @@ void oneFilePerRecordWithPlainValues(final String compression, final TestInfo te
300295
301296
302297 for (final String blobName : expectedBlobs ) {
303- assertTrue (testBucketAccessor .doesObjectExist (blobName ));
298+ assertThat (testBucketAccessor .doesObjectExist (blobName )). isTrue ( );
304299 }
305300
306301 for (final String blobName : expectedBlobsAndContent .keySet ()) {
307- assertEquals (
308- expectedBlobsAndContent .get (blobName ),
309- testBucketAccessor .readLines (blobName , compression ).get (0 )
310- );
302+ assertThat (testBucketAccessor .readLines (blobName , compression ).get (0 ))
303+ .isEqualTo (expectedBlobsAndContent .get (blobName ));
311304 }
312305 }
313306
@@ -366,7 +359,7 @@ void groupByKey(final String compression, final TestInfo testInfo)
366359 .collect (Collectors .toList ());
367360
368361 for (final String blobName : expectedBlobs ) {
369- assertTrue (testBucketAccessor .doesObjectExist (blobName ));
362+ assertThat (testBucketAccessor .doesObjectExist (blobName )). isTrue ( );
370363 }
371364
372365 for (final String blobName : expectedBlobs ) {
@@ -384,7 +377,7 @@ void groupByKey(final String compression, final TestInfo testInfo)
384377 value = lastValuePerKey .get (keyInBlobName );
385378 expectedBlobContent = String .format ("%s,%s" , keyInBlobName , value );
386379 }
387- assertEquals ( expectedBlobContent , blobContent );
380+ assertThat ( blobContent ). isEqualTo ( expectedBlobContent );
388381 }
389382 }
390383
@@ -428,7 +421,7 @@ void jsonlOutputTest(final TestInfo testInfo) throws ExecutionException, Interru
428421 getNewBlobName (topicName , 2 , 0 , compression ),
429422 getNewBlobName (topicName , 3 , 0 , compression ));
430423 for (final String blobName : expectedBlobs ) {
431- assertTrue (testBucketAccessor .doesObjectExist (blobName ));
424+ assertThat (testBucketAccessor .doesObjectExist (blobName )). isTrue ( );
432425 }
433426
434427 final Map <String , List <String >> blobContents = new HashMap <>();
@@ -445,9 +438,9 @@ void jsonlOutputTest(final TestInfo testInfo) throws ExecutionException, Interru
445438 cnt += 1 ;
446439
447440 final String blobName = getNewBlobName (topicName , partition , 0 , "none" );
448- final String actualLine = blobContents .get (blobName ).get (i );
449441 final String expectedLine = "{\" value\" :" + value + ",\" key\" :\" " + key + "\" }" ;
450- assertEquals (expectedLine , actualLine );
442+
443+ assertThat (blobContents .get (blobName ).get (i )).isEqualTo (expectedLine );
451444 }
452445 }
453446 }
@@ -497,29 +490,33 @@ void jsonOutput(final TestInfo testInfo) throws ExecutionException, InterruptedE
497490 getNewBlobName (topicName , 2 , 0 , compression ),
498491 getNewBlobName (topicName , 3 , 0 , compression ));
499492 for (final String blobName : expectedBlobs ) {
500- assertTrue (testBucketAccessor .doesObjectExist (blobName ));
493+ assertThat (testBucketAccessor .doesObjectExist (blobName )). isTrue ( );
501494 }
502495
503496 final Map <String , List <String >> blobContents = new HashMap <>();
504497 for (final String blobName : expectedBlobs ) {
505498 final List <String > items = new ArrayList <>(testBucketAccessor .readLines (blobName , compression ));
506- assertEquals (numEpochs + 2 , items .size ());
499+
500+ assertThat (items ).hasSize (numEpochs + 2 );
501+
507502 blobContents .put (blobName , items );
508503 }
509504
510505 // Each blob must be a JSON array.
511506 for (final KeyValueMessage msg : new KeyValueGenerator (numPartitions , numEpochs , keyGen , valueGen )) {
512507 final String blobName = getNewBlobName (topicName , msg .partition , 0 , compression );
513508 final List <String > blobContent = blobContents .get (blobName );
514- assertEquals ("[" , blobContent .get (0 ));
515- assertEquals ("]" , blobContent .get (blobContent .size () - 1 ));
509+
510+ assertThat (blobContent .get (0 )).isEqualTo ("[" );
511+ assertThat (blobContent .get (blobContent .size () - 1 )).isEqualTo ("]" );
512+
516513 final String actualLine = blobContent .get (msg .epoch + 1 ); // 0 is '['
517514
518515 String expectedLine = "{\" value\" :" + msg .value + ",\" key\" :\" " + msg .key + "\" }" ;
519516 if (actualLine .endsWith ("," )) {
520517 expectedLine += "," ;
521518 }
522- assertEquals ( expectedLine , actualLine );
519+ assertThat ( actualLine ). isEqualTo ( expectedLine );
523520 }
524521 }
525522
0 commit comments