Skip to content

Commit 7a2741b

Browse files
committed
fix: fix test for new projects
1 parent 00bf07b commit 7a2741b

File tree

1 file changed

+26
-0
lines changed
  • src/integration-test/java/com/commercetools/sync/integration/externalsource/customers

1 file changed

+26
-0
lines changed

src/integration-test/java/com/commercetools/sync/integration/externalsource/customers/CustomerSyncIT.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
import com.commercetools.api.models.customer.CustomerUpdateAction;
3636
import com.commercetools.api.models.customer_group.CustomerGroup;
3737
import com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifierBuilder;
38+
import com.commercetools.api.models.project.Project;
39+
import com.commercetools.api.models.project.ProjectUpdateActionBuilder;
40+
import com.commercetools.api.models.project.ProjectUpdateBuilder;
3841
import com.commercetools.api.models.store.Store;
3942
import com.commercetools.api.models.store.StoreResourceIdentifierBuilder;
4043
import com.commercetools.api.models.type.CustomFieldsDraftBuilder;
@@ -47,6 +50,7 @@
4750
import com.commercetools.sync.integration.commons.utils.ITUtils;
4851
import com.commercetools.sync.integration.commons.utils.TestClientUtils;
4952
import com.neovisionaries.i18n.CountryCode;
53+
import io.vrap.rmf.base.client.ApiHttpResponse;
5054
import java.time.LocalDate;
5155
import java.util.ArrayList;
5256
import java.util.List;
@@ -194,6 +198,28 @@ void sync_WithUpdatedCustomer_ShouldUpdateCustomer() {
194198

195199
@Test
196200
void sync_WithUpdatedAllFieldsOfCustomer_ShouldUpdateCustomerWithAllExpectedActions() {
201+
final List<String> languages = List.of("de-DE", "en", Locale.FRENCH.toLanguageTag());
202+
final Project project =
203+
TestClientUtils.CTP_TARGET_CLIENT
204+
.get()
205+
.execute()
206+
.thenApply(ApiHttpResponse::getBody)
207+
.join();
208+
final boolean hasLanguagesBeenAdded = project.getLanguages().containsAll(languages);
209+
if (!hasLanguagesBeenAdded) {
210+
TestClientUtils.CTP_TARGET_CLIENT
211+
.post(
212+
ProjectUpdateBuilder.of()
213+
.actions(
214+
ProjectUpdateActionBuilder.of()
215+
.changeLanguagesBuilder()
216+
.languages(languages)
217+
.build())
218+
.version(project.getVersion())
219+
.build())
220+
.executeBlocking();
221+
}
222+
197223
final Store storeCologne =
198224
CustomerITUtils.ensureStore(TestClientUtils.CTP_TARGET_CLIENT, "store-cologne");
199225
final CustomerGroup customerGroupSilverMember =

0 commit comments

Comments
 (0)