Search in sources :

Example 21 with ShoppingListSyncStatistics

use of com.commercetools.sync.shoppinglists.helpers.ShoppingListSyncStatistics in project commercetools-sync-java by commercetools.

the class ShoppingListSyncTest method sync_WithoutName_ShouldExecuteCallbackOnErrorAndIncreaseFailedCounter.

@Test
void sync_WithoutName_ShouldExecuteCallbackOnErrorAndIncreaseFailedCounter() {
    // preparation
    ShoppingListDraft shoppingListDraft = ShoppingListDraftBuilder.of(LocalizedString.of()).key("shopping-list-key").build();
    ShoppingListSync shoppingListSync = new ShoppingListSync(syncOptions);
    // test
    ShoppingListSyncStatistics statistics = shoppingListSync.sync(singletonList(shoppingListDraft)).toCompletableFuture().join();
    AssertionsForStatistics.assertThat(statistics).hasValues(1, 0, 0, 1);
    // assertions
    assertThat(errorMessages).hasSize(1).singleElement(as(STRING)).isEqualTo(format(SHOPPING_LIST_DRAFT_NAME_NOT_SET, shoppingListDraft.getKey()));
}
Also used : ShoppingListSyncStatistics(com.commercetools.sync.shoppinglists.helpers.ShoppingListSyncStatistics) ShoppingListDraft(io.sphere.sdk.shoppinglists.ShoppingListDraft) Test(org.junit.jupiter.api.Test)

Aggregations

ShoppingListSyncStatistics (com.commercetools.sync.shoppinglists.helpers.ShoppingListSyncStatistics)21 Test (org.junit.jupiter.api.Test)21 ShoppingListDraft (io.sphere.sdk.shoppinglists.ShoppingListDraft)19 CustomerService (com.commercetools.sync.services.CustomerService)13 ShoppingListService (com.commercetools.sync.services.ShoppingListService)13 TypeService (com.commercetools.sync.services.TypeService)13 ShoppingList (io.sphere.sdk.shoppinglists.ShoppingList)13 SphereException (io.sphere.sdk.models.SphereException)6 SyncException (com.commercetools.sync.commons.exceptions.SyncException)3 ConcurrentModificationException (io.sphere.sdk.client.ConcurrentModificationException)3 ShoppingListITUtils.createShoppingList (com.commercetools.sync.integration.commons.utils.ShoppingListITUtils.createShoppingList)2 TextLineItem (io.sphere.sdk.shoppinglists.TextLineItem)2 TextLineItemDraft (io.sphere.sdk.shoppinglists.TextLineItemDraft)2 CompletionException (java.util.concurrent.CompletionException)2 AssertionsForStatistics (com.commercetools.sync.commons.asserts.statistics.AssertionsForStatistics)1 AssertionsForStatistics.assertThat (com.commercetools.sync.commons.asserts.statistics.AssertionsForStatistics.assertThat)1 CaffeineReferenceIdToKeyCacheImpl (com.commercetools.sync.commons.utils.CaffeineReferenceIdToKeyCacheImpl)1 ReferenceIdToKeyCache (com.commercetools.sync.commons.utils.ReferenceIdToKeyCache)1 CustomerITUtils.createSampleCustomerJaneDoe (com.commercetools.sync.integration.commons.utils.CustomerITUtils.createSampleCustomerJaneDoe)1 ShoppingListITUtils.createSampleShoppingListCarrotCake (com.commercetools.sync.integration.commons.utils.ShoppingListITUtils.createSampleShoppingListCarrotCake)1