use of com.commercetools.sync.services.CustomerGroupService in project commercetools-sync-java by commercetools.
the class ProductSyncMockUtils method getMockCustomerGroupService.
/**
* Creates a mock {@link CustomerGroupService} that returns a completed {@link CompletableFuture}
* containing an {@link Optional} containing the id of the supplied value whenever the following
* method is called on the service:
*
* <ul>
* <li>{@link CustomerGroupService#fetchCachedCustomerGroupId(String)}
* </ul>
*
* @return the created mock of the {@link CustomerGroupService}.
*/
public static CustomerGroupService getMockCustomerGroupService(@Nonnull final CustomerGroup customerGroup) {
final String customerGroupId = customerGroup.getId();
final CustomerGroupService customerGroupService = mock(CustomerGroupService.class);
when(customerGroupService.fetchCachedCustomerGroupId(anyString())).thenReturn(completedFuture(Optional.of(customerGroupId)));
return customerGroupService;
}
use of com.commercetools.sync.services.CustomerGroupService in project commercetools-sync-java by commercetools.
the class CustomerGroupServiceImplIT method setup.
/**
* Deletes customer group from the target CTP projects, then it populates the project with test
* data.
*/
@BeforeEach
void setup() {
deleteCustomerGroups(CTP_TARGET_CLIENT);
warnings = new ArrayList<>();
oldCustomerGroup = createCustomerGroup(CTP_TARGET_CLIENT, CUSTOMER_GROUP_NAME, CUSTOMER_GROUP_KEY);
final ProductSyncOptions productSyncOptions = ProductSyncOptionsBuilder.of(CTP_TARGET_CLIENT).warningCallback((exception, oldResource, newResource) -> warnings.add(exception.getMessage())).build();
customerGroupService = new CustomerGroupServiceImpl(productSyncOptions);
}
Aggregations