From 8f922fbbf4cd543dc8d860d286ff090d7949b466 Mon Sep 17 00:00:00 2001 From: Lam Tran Date: Mon, 6 Nov 2023 11:13:20 +0100 Subject: [PATCH] Add class type to sync statistics (#1105) --- .../helpers/CartDiscountSyncStatistics.java | 8 +++++- .../helpers/CategorySyncStatistics.java | 7 +++++- .../commercetools/sync/commons/BaseSync.java | 4 +-- .../commons/helpers/BaseSyncStatistics.java | 25 ++++++++++++++++++- .../helpers/CustomerSyncStatistics.java | 7 +++++- .../helpers/CustomObjectSyncStatistics.java | 7 +++++- .../helpers/InventorySyncStatistics.java | 7 +++++- .../helpers/ProductSyncStatistics.java | 7 +++++- .../helpers/ProductTypeSyncStatistics.java | 7 +++++- .../helpers/ShoppingListSyncStatistics.java | 8 +++++- .../states/helpers/StateSyncStatistics.java | 7 +++++- .../helpers/TaxCategorySyncStatistics.java | 7 +++++- .../types/helpers/TypeSyncStatistics.java | 7 +++++- .../CartDiscountSyncStatisticsTest.java | 6 +++++ .../helpers/CategorySyncStatisticsTest.java | 6 +++++ .../helpers/CustomerSyncStatisticsTest.java | 6 +++++ .../CustomObjectSyncStatisticsTest.java | 6 +++++ .../helpers/InventorySyncStatisticsTest.java | 6 +++++ .../helpers/ProductSyncStatisticsTest.java | 6 +++++ .../ProductTypeSyncStatisticsTest.java | 14 +++++++++++ .../ShoppingListSyncStatisticsTest.java | 6 +++++ .../helpers/StateSyncStatisticsTest.java | 6 +++++ .../TaxCategorySyncStatisticsTest.java | 6 +++++ .../types/helpers/TypeSyncStatisticsTest.java | 6 +++++ 24 files changed, 168 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/commercetools/sync/cartdiscounts/helpers/CartDiscountSyncStatistics.java b/src/main/java/com/commercetools/sync/cartdiscounts/helpers/CartDiscountSyncStatistics.java index 38af206da3..a8fe3f5854 100644 --- a/src/main/java/com/commercetools/sync/cartdiscounts/helpers/CartDiscountSyncStatistics.java +++ b/src/main/java/com/commercetools/sync/cartdiscounts/helpers/CartDiscountSyncStatistics.java @@ -2,7 +2,8 @@ import com.commercetools.sync.commons.helpers.BaseSyncStatistics; -public final class CartDiscountSyncStatistics extends BaseSyncStatistics { +public final class CartDiscountSyncStatistics + extends BaseSyncStatistics { /** * Builds a summary of the cart discount sync statistics instance that looks like the following @@ -17,4 +18,9 @@ public final class CartDiscountSyncStatistics extends BaseSyncStatistics { public String getReportMessage() { return getDefaultReportMessageForResource("cart discounts"); } + + @Override + protected CartDiscountSyncStatistics getThis() { + return this; + } } diff --git a/src/main/java/com/commercetools/sync/categories/helpers/CategorySyncStatistics.java b/src/main/java/com/commercetools/sync/categories/helpers/CategorySyncStatistics.java index 80fbd6d16d..4f2597bd6d 100644 --- a/src/main/java/com/commercetools/sync/categories/helpers/CategorySyncStatistics.java +++ b/src/main/java/com/commercetools/sync/categories/helpers/CategorySyncStatistics.java @@ -10,7 +10,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -public class CategorySyncStatistics extends BaseSyncStatistics { +public class CategorySyncStatistics extends BaseSyncStatistics { /** * The following {@link java.util.Map} ({@code categoryKeysWithMissingParents}) represents @@ -52,6 +52,11 @@ public String getReportMessage() { getNumberOfCategoriesWithMissingParents()); } + @Override + protected CategorySyncStatistics getThis() { + return this; + } + /** * Returns the total number of categories with missing parents. * diff --git a/src/main/java/com/commercetools/sync/commons/BaseSync.java b/src/main/java/com/commercetools/sync/commons/BaseSync.java index d9bb5fccff..053e4c4a15 100644 --- a/src/main/java/com/commercetools/sync/commons/BaseSync.java +++ b/src/main/java/com/commercetools/sync/commons/BaseSync.java @@ -15,8 +15,8 @@ public abstract class BaseSync< ResourceT extends BaseResource, ResourceDraftT, ResourceUpdateActionT extends ResourceUpdateAction, - SyncStatisticsT extends BaseSyncStatistics, - SyncOptionsT extends BaseSyncOptions> { + SyncStatisticsT extends BaseSyncStatistics, + SyncOptionsT extends BaseSyncOptions> { protected final SyncStatisticsT statistics; protected final SyncOptionsT syncOptions; diff --git a/src/main/java/com/commercetools/sync/commons/helpers/BaseSyncStatistics.java b/src/main/java/com/commercetools/sync/commons/helpers/BaseSyncStatistics.java index cbe860663c..558232c20e 100644 --- a/src/main/java/com/commercetools/sync/commons/helpers/BaseSyncStatistics.java +++ b/src/main/java/com/commercetools/sync/commons/helpers/BaseSyncStatistics.java @@ -6,7 +6,7 @@ import java.util.concurrent.atomic.AtomicInteger; import javax.annotation.Nonnull; -public abstract class BaseSyncStatistics { +public abstract class BaseSyncStatistics { private AtomicInteger updated; private AtomicInteger created; private AtomicInteger failed; @@ -280,6 +280,29 @@ public long getLatestBatchProcessingTimeInMillis() { */ public abstract String getReportMessage(); + /** + * Gets the name of the implementation class extending this abstract class. This name is then + * serialized into JSON and stored in the custom object of the last sync statistics. Later we + * could use this name to deserialize the custom object into the correct implementation class. + * + * @return name of the implementation class extending this abstract class. + */ + public String getSyncStatisticsClassName() { + return getThis().getClass().getName(); + } + + /** + * Returns {@code this} instance of {@code T}, which extends {@link + * com.commercetools.sync.commons.helpers.BaseSyncStatistics}. The purpose of this method is to + * make sure that {@code this} is an instance of a class which extends {@link + * com.commercetools.sync.commons.helpers.BaseSyncStatistics} in order to be used in the generic + * methods of the class. Otherwise, without this method, the methods above would need to cast + * {@code this to T} which could lead to a runtime error of the class was extended in a wrong way. + * + * @return an instance of the class that overrides this method. + */ + protected abstract SyncStatisticsT getThis(); + /** * Builds a proper summary message of the statistics report of a given {@code resourceString} in * following format: diff --git a/src/main/java/com/commercetools/sync/customers/helpers/CustomerSyncStatistics.java b/src/main/java/com/commercetools/sync/customers/helpers/CustomerSyncStatistics.java index f99a8272cf..56ca9983ef 100644 --- a/src/main/java/com/commercetools/sync/customers/helpers/CustomerSyncStatistics.java +++ b/src/main/java/com/commercetools/sync/customers/helpers/CustomerSyncStatistics.java @@ -2,7 +2,7 @@ import com.commercetools.sync.commons.helpers.BaseSyncStatistics; -public class CustomerSyncStatistics extends BaseSyncStatistics { +public class CustomerSyncStatistics extends BaseSyncStatistics { /** * Builds a summary of the customer sync statistics instance that looks like the following @@ -17,4 +17,9 @@ public class CustomerSyncStatistics extends BaseSyncStatistics { public String getReportMessage() { return getDefaultReportMessageForResource("customers"); } + + @Override + protected CustomerSyncStatistics getThis() { + return this; + } } diff --git a/src/main/java/com/commercetools/sync/customobjects/helpers/CustomObjectSyncStatistics.java b/src/main/java/com/commercetools/sync/customobjects/helpers/CustomObjectSyncStatistics.java index 85f7b5ea78..2115527d60 100644 --- a/src/main/java/com/commercetools/sync/customobjects/helpers/CustomObjectSyncStatistics.java +++ b/src/main/java/com/commercetools/sync/customobjects/helpers/CustomObjectSyncStatistics.java @@ -2,7 +2,7 @@ import com.commercetools.sync.commons.helpers.BaseSyncStatistics; -public class CustomObjectSyncStatistics extends BaseSyncStatistics { +public class CustomObjectSyncStatistics extends BaseSyncStatistics { /** * Builds a summary of the custom object sync statistics instance that looks like the following * example: @@ -16,4 +16,9 @@ public class CustomObjectSyncStatistics extends BaseSyncStatistics { public String getReportMessage() { return getDefaultReportMessageForResource("custom objects"); } + + @Override + protected CustomObjectSyncStatistics getThis() { + return this; + } } diff --git a/src/main/java/com/commercetools/sync/inventories/helpers/InventorySyncStatistics.java b/src/main/java/com/commercetools/sync/inventories/helpers/InventorySyncStatistics.java index 410a2e62cf..9c9db0052e 100644 --- a/src/main/java/com/commercetools/sync/inventories/helpers/InventorySyncStatistics.java +++ b/src/main/java/com/commercetools/sync/inventories/helpers/InventorySyncStatistics.java @@ -2,7 +2,7 @@ import com.commercetools.sync.commons.helpers.BaseSyncStatistics; -public class InventorySyncStatistics extends BaseSyncStatistics { +public class InventorySyncStatistics extends BaseSyncStatistics { public InventorySyncStatistics() { super(); @@ -22,4 +22,9 @@ public InventorySyncStatistics() { public String getReportMessage() { return getDefaultReportMessageForResource("inventory entries"); } + + @Override + protected InventorySyncStatistics getThis() { + return this; + } } diff --git a/src/main/java/com/commercetools/sync/products/helpers/ProductSyncStatistics.java b/src/main/java/com/commercetools/sync/products/helpers/ProductSyncStatistics.java index 125e75ab07..2ffc0a52f1 100644 --- a/src/main/java/com/commercetools/sync/products/helpers/ProductSyncStatistics.java +++ b/src/main/java/com/commercetools/sync/products/helpers/ProductSyncStatistics.java @@ -11,7 +11,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -public class ProductSyncStatistics extends BaseSyncStatistics { +public class ProductSyncStatistics extends BaseSyncStatistics { /** * The following {@link Map} ({@code productKeysWithMissingParents}) represents products with @@ -47,6 +47,11 @@ public String getReportMessage() { getNumberOfProductsWithMissingParents()); } + @Override + protected ProductSyncStatistics getThis() { + return this; + } + /** * Returns the total number of products with missing parents. * diff --git a/src/main/java/com/commercetools/sync/producttypes/helpers/ProductTypeSyncStatistics.java b/src/main/java/com/commercetools/sync/producttypes/helpers/ProductTypeSyncStatistics.java index 2a3c1c8374..68f5e12331 100644 --- a/src/main/java/com/commercetools/sync/producttypes/helpers/ProductTypeSyncStatistics.java +++ b/src/main/java/com/commercetools/sync/producttypes/helpers/ProductTypeSyncStatistics.java @@ -13,7 +13,7 @@ import java.util.concurrent.ConcurrentHashMap; import javax.annotation.Nonnull; -public class ProductTypeSyncStatistics extends BaseSyncStatistics { +public class ProductTypeSyncStatistics extends BaseSyncStatistics { /** * The following {@link java.util.concurrent.ConcurrentHashMap} ({@code @@ -82,6 +82,11 @@ public String getReportMessage() { getNumberOfProductTypesWithMissingNestedProductTypes()); } + @Override + protected ProductTypeSyncStatistics getThis() { + return this; + } + /** * Returns the total number of product types with at least one NestedType or a Set of NestedType * attribute definition(s) referencing a missing productType. diff --git a/src/main/java/com/commercetools/sync/shoppinglists/helpers/ShoppingListSyncStatistics.java b/src/main/java/com/commercetools/sync/shoppinglists/helpers/ShoppingListSyncStatistics.java index 78e0f358c8..1dd27dc689 100644 --- a/src/main/java/com/commercetools/sync/shoppinglists/helpers/ShoppingListSyncStatistics.java +++ b/src/main/java/com/commercetools/sync/shoppinglists/helpers/ShoppingListSyncStatistics.java @@ -2,7 +2,8 @@ import com.commercetools.sync.commons.helpers.BaseSyncStatistics; -public final class ShoppingListSyncStatistics extends BaseSyncStatistics { +public final class ShoppingListSyncStatistics + extends BaseSyncStatistics { /** * Builds a summary of the shopping list sync statistics instance that looks like the following @@ -17,4 +18,9 @@ public final class ShoppingListSyncStatistics extends BaseSyncStatistics { public String getReportMessage() { return getDefaultReportMessageForResource("shopping lists"); } + + @Override + protected ShoppingListSyncStatistics getThis() { + return this; + } } diff --git a/src/main/java/com/commercetools/sync/states/helpers/StateSyncStatistics.java b/src/main/java/com/commercetools/sync/states/helpers/StateSyncStatistics.java index 57574ffffd..b7b41f6307 100644 --- a/src/main/java/com/commercetools/sync/states/helpers/StateSyncStatistics.java +++ b/src/main/java/com/commercetools/sync/states/helpers/StateSyncStatistics.java @@ -11,7 +11,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -public class StateSyncStatistics extends BaseSyncStatistics { +public class StateSyncStatistics extends BaseSyncStatistics { /** * The following {@link java.util.Map} ({@code stateKeysWithMissingParents}) represents products @@ -48,6 +48,11 @@ public String getReportMessage() { getNumberOfStatesWithMissingParents()); } + @Override + protected StateSyncStatistics getThis() { + return this; + } + /** * Returns the total number of states with missing parents. * diff --git a/src/main/java/com/commercetools/sync/taxcategories/helpers/TaxCategorySyncStatistics.java b/src/main/java/com/commercetools/sync/taxcategories/helpers/TaxCategorySyncStatistics.java index 436bd3b927..2d4bb6720e 100644 --- a/src/main/java/com/commercetools/sync/taxcategories/helpers/TaxCategorySyncStatistics.java +++ b/src/main/java/com/commercetools/sync/taxcategories/helpers/TaxCategorySyncStatistics.java @@ -6,7 +6,7 @@ * Tax category sync statistics. Keeps track of processed, created, updated and failed states * through whole sync process. */ -public final class TaxCategorySyncStatistics extends BaseSyncStatistics { +public final class TaxCategorySyncStatistics extends BaseSyncStatistics { /** * Builds a summary of the tax category sync statistics instance that looks like the following @@ -21,4 +21,9 @@ public final class TaxCategorySyncStatistics extends BaseSyncStatistics { public String getReportMessage() { return getDefaultReportMessageForResource("tax categories"); } + + @Override + protected TaxCategorySyncStatistics getThis() { + return this; + } } diff --git a/src/main/java/com/commercetools/sync/types/helpers/TypeSyncStatistics.java b/src/main/java/com/commercetools/sync/types/helpers/TypeSyncStatistics.java index cc13f14e16..03e937cabf 100644 --- a/src/main/java/com/commercetools/sync/types/helpers/TypeSyncStatistics.java +++ b/src/main/java/com/commercetools/sync/types/helpers/TypeSyncStatistics.java @@ -2,7 +2,7 @@ import com.commercetools.sync.commons.helpers.BaseSyncStatistics; -public class TypeSyncStatistics extends BaseSyncStatistics { +public class TypeSyncStatistics extends BaseSyncStatistics { /** * Builds a summary of the type sync statistics instance that looks like the following example: * @@ -14,4 +14,9 @@ public class TypeSyncStatistics extends BaseSyncStatistics { public String getReportMessage() { return getDefaultReportMessageForResource("types"); } + + @Override + protected TypeSyncStatistics getThis() { + return this; + } } diff --git a/src/test/java/com/commercetools/sync/cartdiscounts/helpers/CartDiscountSyncStatisticsTest.java b/src/test/java/com/commercetools/sync/cartdiscounts/helpers/CartDiscountSyncStatisticsTest.java index 2f22375de4..5a9109e69c 100644 --- a/src/test/java/com/commercetools/sync/cartdiscounts/helpers/CartDiscountSyncStatisticsTest.java +++ b/src/test/java/com/commercetools/sync/cartdiscounts/helpers/CartDiscountSyncStatisticsTest.java @@ -25,4 +25,10 @@ void getReportMessage_WithIncrementedStats_ShouldGetCorrectMessage() { "Summary: 6 cart discounts were processed in total " + "(1 created, 3 updated and 2 failed to sync)."); } + + @Test + void getSyncStatisticsClassName_ShouldReturnCorrectClassName() { + assertThat(cartDiscountSyncStatistics.getSyncStatisticsClassName()) + .isEqualTo("com.commercetools.sync.cartdiscounts.helpers.CartDiscountSyncStatistics"); + } } diff --git a/src/test/java/com/commercetools/sync/categories/helpers/CategorySyncStatisticsTest.java b/src/test/java/com/commercetools/sync/categories/helpers/CategorySyncStatisticsTest.java index b59ed5e469..b89e9d0c5d 100644 --- a/src/test/java/com/commercetools/sync/categories/helpers/CategorySyncStatisticsTest.java +++ b/src/test/java/com/commercetools/sync/categories/helpers/CategorySyncStatisticsTest.java @@ -151,4 +151,10 @@ void removeChildCategoryKeyFromMissingParentsMap_WithExistingKey_ShouldRemovePar // assert assertThat(categorySyncStatistics.getNumberOfCategoriesWithMissingParents()).isEqualTo(0); } + + @Test + void getSyncStatisticsClassName_ShouldReturnCorrectClassName() { + assertThat(categorySyncStatistics.getSyncStatisticsClassName()) + .isEqualTo("com.commercetools.sync.categories.helpers.CategorySyncStatistics"); + } } diff --git a/src/test/java/com/commercetools/sync/customers/helpers/CustomerSyncStatisticsTest.java b/src/test/java/com/commercetools/sync/customers/helpers/CustomerSyncStatisticsTest.java index 5489c5b1e7..abd0ca6a85 100644 --- a/src/test/java/com/commercetools/sync/customers/helpers/CustomerSyncStatisticsTest.java +++ b/src/test/java/com/commercetools/sync/customers/helpers/CustomerSyncStatisticsTest.java @@ -25,4 +25,10 @@ void getReportMessage_WithIncrementedStats_ShouldGetCorrectMessage() { "Summary: 6 customers were processed in total " + "(1 created, 3 updated and 2 failed to sync)."); } + + @Test + void getSyncStatisticsClassName_ShouldReturnCorrectClassName() { + assertThat(customerSyncStatistics.getSyncStatisticsClassName()) + .isEqualTo("com.commercetools.sync.customers.helpers.CustomerSyncStatistics"); + } } diff --git a/src/test/java/com/commercetools/sync/customobjects/helpers/CustomObjectSyncStatisticsTest.java b/src/test/java/com/commercetools/sync/customobjects/helpers/CustomObjectSyncStatisticsTest.java index 4e1ccee92f..6dfc2a0688 100644 --- a/src/test/java/com/commercetools/sync/customobjects/helpers/CustomObjectSyncStatisticsTest.java +++ b/src/test/java/com/commercetools/sync/customobjects/helpers/CustomObjectSyncStatisticsTest.java @@ -25,4 +25,10 @@ void getReportMessage_WithIncrementedStats_ShouldGetCorrectMessage() { "Summary: 6 custom objects were processed in total " + "(1 created, 3 updated and 2 failed to sync)."); } + + @Test + void getSyncStatisticsClassName_ShouldReturnCorrectClassName() { + assertThat(customObjectSyncStatistics.getSyncStatisticsClassName()) + .isEqualTo("com.commercetools.sync.customobjects.helpers.CustomObjectSyncStatistics"); + } } diff --git a/src/test/java/com/commercetools/sync/inventories/helpers/InventorySyncStatisticsTest.java b/src/test/java/com/commercetools/sync/inventories/helpers/InventorySyncStatisticsTest.java index 16988c28e5..ad27814719 100644 --- a/src/test/java/com/commercetools/sync/inventories/helpers/InventorySyncStatisticsTest.java +++ b/src/test/java/com/commercetools/sync/inventories/helpers/InventorySyncStatisticsTest.java @@ -26,4 +26,10 @@ void getReportMessage_WithIncrementedStats_ShouldGetCorrectMessage() { "Summary: 3 inventory entries were processed in total " + "(1 created, 1 updated and 1 failed to sync)."); } + + @Test + void getSyncStatisticsClassName_ShouldReturnCorrectClassName() { + assertThat(inventorySyncStatistics.getSyncStatisticsClassName()) + .isEqualTo("com.commercetools.sync.inventories.helpers.InventorySyncStatistics"); + } } diff --git a/src/test/java/com/commercetools/sync/products/helpers/ProductSyncStatisticsTest.java b/src/test/java/com/commercetools/sync/products/helpers/ProductSyncStatisticsTest.java index 65420dcd50..ac1595298e 100644 --- a/src/test/java/com/commercetools/sync/products/helpers/ProductSyncStatisticsTest.java +++ b/src/test/java/com/commercetools/sync/products/helpers/ProductSyncStatisticsTest.java @@ -133,4 +133,10 @@ void removeAndGetReferencingKeys_WithExistingKey_ShouldGetAndRemoveAllKeys() { assertThat(result).containsExactly("b", "c"); assertThat(productSyncStatistics.getNumberOfProductsWithMissingParents()).isEqualTo(1); } + + @Test + void getSyncStatisticsClassName_ShouldReturnCorrectClassName() { + assertThat(productSyncStatistics.getSyncStatisticsClassName()) + .isEqualTo("com.commercetools.sync.products.helpers.ProductSyncStatistics"); + } } diff --git a/src/test/java/com/commercetools/sync/producttypes/helpers/ProductTypeSyncStatisticsTest.java b/src/test/java/com/commercetools/sync/producttypes/helpers/ProductTypeSyncStatisticsTest.java index 63f0ca0fbc..3c4c6d7a57 100644 --- a/src/test/java/com/commercetools/sync/producttypes/helpers/ProductTypeSyncStatisticsTest.java +++ b/src/test/java/com/commercetools/sync/producttypes/helpers/ProductTypeSyncStatisticsTest.java @@ -722,4 +722,18 @@ void removeReferencingProductTypeKey_WithOnlyOccurrenceForMissingRef_ShouldRemov assertThat(productTypeSyncStatistics.getProductTypeKeysWithMissingParents().get("missing2")) .containsOnlyKeys("referencing-product-type-4"); } + + @Test + void getSyncStatisticsClassName_ShouldReturnCorrectClassName() { + // preparation + final ProductTypeSyncStatistics productTypeSyncStatistics = + new ProductTypeSyncStatistics(new ConcurrentHashMap<>()); + + // test + final String className = productTypeSyncStatistics.getSyncStatisticsClassName(); + + // assertion + assertThat(className) + .isEqualTo("com.commercetools.sync.producttypes.helpers.ProductTypeSyncStatistics"); + } } diff --git a/src/test/java/com/commercetools/sync/shoppinglists/helpers/ShoppingListSyncStatisticsTest.java b/src/test/java/com/commercetools/sync/shoppinglists/helpers/ShoppingListSyncStatisticsTest.java index fb23367e54..8bba2f1424 100644 --- a/src/test/java/com/commercetools/sync/shoppinglists/helpers/ShoppingListSyncStatisticsTest.java +++ b/src/test/java/com/commercetools/sync/shoppinglists/helpers/ShoppingListSyncStatisticsTest.java @@ -25,4 +25,10 @@ void getReportMessage_WithIncrementedStats_ShouldGetCorrectMessage() { "Summary: 6 shopping lists were processed in total " + "(1 created, 3 updated and 2 failed to sync)."); } + + @Test + void getSyncStatisticsClassName_ShouldReturnCorrectClassName() { + assertThat(shoppingListSyncStatistics.getSyncStatisticsClassName()) + .isEqualTo("com.commercetools.sync.shoppinglists.helpers.ShoppingListSyncStatistics"); + } } diff --git a/src/test/java/com/commercetools/sync/states/helpers/StateSyncStatisticsTest.java b/src/test/java/com/commercetools/sync/states/helpers/StateSyncStatisticsTest.java index 317e7afdcb..ed590a62a4 100644 --- a/src/test/java/com/commercetools/sync/states/helpers/StateSyncStatisticsTest.java +++ b/src/test/java/com/commercetools/sync/states/helpers/StateSyncStatisticsTest.java @@ -134,4 +134,10 @@ void removeAndGetReferencingKeys_WithExistingKey_ShouldGetAndRemoveAllKeys() { assertThat(result).containsExactly("b", "c"); assertThat(stateSyncStatistics.getNumberOfStatesWithMissingParents()).isEqualTo(1); } + + @Test + void getSyncStatisticsClassName_ShouldReturnCorrectClassName() { + assertThat(stateSyncStatistics.getSyncStatisticsClassName()) + .isEqualTo("com.commercetools.sync.states.helpers.StateSyncStatistics"); + } } diff --git a/src/test/java/com/commercetools/sync/taxcategories/helpers/TaxCategorySyncStatisticsTest.java b/src/test/java/com/commercetools/sync/taxcategories/helpers/TaxCategorySyncStatisticsTest.java index 5b1aaed27f..08d06c39bf 100644 --- a/src/test/java/com/commercetools/sync/taxcategories/helpers/TaxCategorySyncStatisticsTest.java +++ b/src/test/java/com/commercetools/sync/taxcategories/helpers/TaxCategorySyncStatisticsTest.java @@ -29,4 +29,10 @@ void getReportMessage_WithRandomStats_ShouldGetCorrectMessage() { + "total (%s created, %s updated and %s failed to sync).", processed, created, updated, failed); } + + @Test + void getSyncStatisticsClassName_ShouldReturnCorrectClassName() { + assertThat(new TaxCategorySyncStatistics().getSyncStatisticsClassName()) + .isEqualTo("com.commercetools.sync.taxcategories.helpers.TaxCategorySyncStatistics"); + } } diff --git a/src/test/java/com/commercetools/sync/types/helpers/TypeSyncStatisticsTest.java b/src/test/java/com/commercetools/sync/types/helpers/TypeSyncStatisticsTest.java index 56b18210fd..a6ac469c13 100644 --- a/src/test/java/com/commercetools/sync/types/helpers/TypeSyncStatisticsTest.java +++ b/src/test/java/com/commercetools/sync/types/helpers/TypeSyncStatisticsTest.java @@ -25,4 +25,10 @@ void getReportMessage_WithIncrementedStats_ShouldGetCorrectMessage() { "Summary: 6 types were processed in total " + "(1 created, 3 updated and 2 failed to sync)."); } + + @Test + void getSyncStatisticsClassName_ShouldReturnCorrectClassName() { + assertThat(typeSyncStatistics.getSyncStatisticsClassName()) + .isEqualTo("com.commercetools.sync.types.helpers.TypeSyncStatistics"); + } }