2828
2929import static com .commercetools .sync .categories .utils .CategoryReferenceReplacementUtils .buildCategoryQuery ;
3030import static com .commercetools .sync .categories .utils .CategoryReferenceReplacementUtils .replaceCategoriesReferenceIdsWithKeys ;
31+ import static com .commercetools .sync .commons .asserts .statistics .AssertionsForStatistics .assertThat ;
3132import static com .commercetools .sync .commons .utils .SyncUtils .batchElements ;
3233import static com .commercetools .sync .integration .commons .utils .CategoryITUtils .OLD_CATEGORY_CUSTOM_TYPE_KEY ;
3334import static com .commercetools .sync .integration .commons .utils .CategoryITUtils .createCategories ;
@@ -114,10 +115,7 @@ public void syncDrafts_withChangesOnly_ShouldUpdateCategories() {
114115
115116 final CategorySyncStatistics syncStatistics = categorySync .sync (categoryDrafts ).toCompletableFuture ().join ();
116117
117- assertThat (syncStatistics .getProcessed ()).isEqualTo (2 );
118- assertThat (syncStatistics .getCreated ()).isEqualTo (0 );
119- assertThat (syncStatistics .getUpdated ()).isEqualTo (2 );
120- assertThat (syncStatistics .getFailed ()).isEqualTo (0 );
118+ assertThat (syncStatistics ).hasValues (2 , 0 , 2 , 0 );
121119 assertThat (callBackErrorResponses ).isEmpty ();
122120 assertThat (callBackExceptions ).isEmpty ();
123121 assertThat (callBackWarningResponses ).isEmpty ();
@@ -136,10 +134,7 @@ public void syncDrafts_withNewCategories_ShouldCreateCategories() {
136134
137135 final CategorySyncStatistics syncStatistics = categorySync .sync (categoryDrafts ).toCompletableFuture ().join ();
138136
139- assertThat (syncStatistics .getReportMessage ())
140- .isEqualTo (format ("Summary: %d categories were processed in total (%d created, %d updated, %d failed to "
141- + "sync and %s categories with a missing parent)." , 3 , 1 , 2 , 0 , 0 ));
142-
137+ assertThat (syncStatistics ).hasValues (3 , 1 , 2 , 0 , 0 );
143138 assertThat (callBackErrorResponses ).isEmpty ();
144139 assertThat (callBackExceptions ).isEmpty ();
145140 assertThat (callBackWarningResponses ).isEmpty ();
@@ -159,9 +154,7 @@ public void syncDrafts_WithUpdatedCategoriesWithoutReferenceKeys_ShouldNotSyncCa
159154
160155 final CategorySyncStatistics syncStatistics = categorySync .sync (categoryDrafts ).toCompletableFuture ().join ();
161156
162- assertThat (syncStatistics .getReportMessage ())
163- .isEqualTo (format ("Summary: %d categories were processed in total (%d created, %d updated, %d failed to "
164- + "sync and %s categories with a missing parent)." , 2 , 0 , 0 , 2 , 0 ));
157+ assertThat (syncStatistics ).hasValues (2 , 0 , 0 , 2 , 0 );
165158 assertThat (callBackErrorResponses ).hasSize (2 );
166159 final String key1 = categoryDrafts .get (0 ).getKey ();
167160 assertThat (callBackErrorResponses .get (0 )).isEqualTo (format ("Failed to resolve references on CategoryDraft with"
@@ -225,9 +218,7 @@ public void syncDrafts_withNewShuffledBatchOfCategories_ShouldCreateCategories()
225218 final CategorySyncStatistics syncStatistics = syncBatches (categorySync , batches ,
226219 CompletableFuture .completedFuture (null )).toCompletableFuture ().join ();
227220
228- assertThat (syncStatistics .getReportMessage ())
229- .isEqualTo (format ("Summary: %d categories were processed in total (%d created, %d updated, %d failed to "
230- + "sync and %s categories with a missing parent)." , 130 , 130 , 0 , 0 , 0 ));
221+ assertThat (syncStatistics ).hasValues (130 , 130 , 0 , 0 , 0 );
231222 assertThat (callBackErrorResponses ).isEmpty ();
232223 assertThat (callBackExceptions ).isEmpty ();
233224 assertThat (callBackWarningResponses ).isEmpty ();
@@ -281,10 +272,7 @@ public void syncDrafts_withExistingShuffledCategoriesWithChangingCategoryHierarc
281272 final CategorySyncStatistics syncStatistics = syncBatches (categorySync , batches ,
282273 CompletableFuture .completedFuture (null )).toCompletableFuture ().join ();
283274
284- assertThat (syncStatistics .getReportMessage ())
285- .isEqualTo (format ("Summary: %d categories were processed in total (%d created, %d updated, %d failed to "
286- + "sync and %s categories with a missing parent)." , 130 , 0 , 120 , 0 , 0 ));
287-
275+ assertThat (syncStatistics ).hasValues (130 , 0 , 120 , 0 , 0 );
288276 assertThat (callBackErrorResponses ).isEmpty ();
289277 assertThat (callBackExceptions ).isEmpty ();
290278 assertThat (callBackWarningResponses ).isEmpty ();
@@ -327,10 +315,7 @@ public void syncDrafts_withExistingCategoriesThatChangeParents_ShouldUpdateCateg
327315 final CategorySyncStatistics syncStatistics = syncBatches (categorySync , batches ,
328316 CompletableFuture .completedFuture (null )).toCompletableFuture ().join ();
329317
330- assertThat (syncStatistics .getReportMessage ())
331- .isEqualTo (format ("Summary: %d categories were processed in total (%d created, %d updated, %d failed to "
332- + "sync and %s categories with a missing parent)." , 3 , 0 , 1 , 0 , 0 ));
333-
318+ assertThat (syncStatistics ).hasValues (3 , 0 , 1 , 0 , 0 );
334319 assertThat (callBackErrorResponses ).isEmpty ();
335320 assertThat (callBackExceptions ).isEmpty ();
336321 assertThat (callBackWarningResponses ).isEmpty ();
@@ -399,10 +384,7 @@ public void syncDrafts_withANonExistingNewParent_ShouldUpdateCategories() {
399384 final CategorySyncStatistics syncStatistics = syncBatches (categorySync , batches ,
400385 CompletableFuture .completedFuture (null )).toCompletableFuture ().join ();
401386
402- assertThat (syncStatistics .getReportMessage ())
403- .isEqualTo (format ("Summary: %d categories were processed in total (%d created, %d updated, %d failed to "
404- + "sync and %s categories with a missing parent)." , 2 , 1 , 1 , 0 , 0 ));
405-
387+ assertThat (syncStatistics ).hasValues (2 , 1 , 1 , 0 , 0 );
406388 assertThat (callBackErrorResponses ).isEmpty ();
407389 assertThat (callBackExceptions ).isEmpty ();
408390 assertThat (callBackWarningResponses ).isEmpty ();
@@ -451,10 +433,7 @@ public void syncDrafts_fromCategoriesWithoutKeys_ShouldNotUpdateCategories() {
451433
452434 final CategorySyncStatistics syncStatistics = categorySync .sync (categoryDrafts ).toCompletableFuture ().join ();
453435
454- assertThat (syncStatistics .getReportMessage ())
455- .isEqualTo (format ("Summary: %d categories were processed in total (%d created, %d updated, %d failed to "
456- + "sync and %s categories with a missing parent)." , 2 , 0 , 0 , 2 , 0 ));
457-
436+ assertThat (syncStatistics ).hasValues (2 , 0 , 0 , 2 , 0 );
458437 assertThat (callBackErrorResponses ).hasSize (2 );
459438 assertThat (callBackErrorResponses .get (0 ))
460439 .containsPattern ("A duplicate value '.*' exists for field 'slug\\ .en' on " );
0 commit comments