Skip to content

Commit 8c11134

Browse files
committed
SUPPORT-28804 clean up integrationtests
1 parent 6f1b831 commit 8c11134

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

commercetools/commercetools-sdk-java-api/src/integrationTest/java/cleanup/DeleteEverythingIntegrationTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ public void execute() {
8282
}
8383
}
8484

85-
private <TMethod extends SimplePagedQueryResourceRequest<TMethod, TResult, ?>, TResult extends ResourcePagedQueryResponse<TElement>, TElement extends DomainResource<TElement>> void deleteAllResources(
85+
private static <TMethod extends SimplePagedQueryResourceRequest<TMethod, TResult, ?>, TResult extends ResourcePagedQueryResponse<TElement>, TElement extends DomainResource<TElement>> void deleteAllResources(
8686
SimplePagedQueryResourceRequest<TMethod, TResult, ?> request, Consumer<TElement> deleteFn) {
8787

8888
QueryUtils.queryAll(request, list -> {
8989
list.forEach(deleteFn);
9090
}, 100).toCompletableFuture().join();
9191
}
9292

93-
private void checkDepends(Runnable block) {
93+
public static void checkDepends(Runnable block) {
9494
assertEventually(Duration.ofSeconds(60), Duration.ofMillis(1000), block);
9595
}
9696

@@ -212,7 +212,7 @@ private void deleteAllCategories() {
212212
} while (response.getResults().size() != 0);
213213
}
214214

215-
private void deleteAllCartDiscounts() {
215+
public static void deleteAllCartDiscounts() {
216216
checkDepends(() -> Assertions.assertThat(
217217
CommercetoolsTestUtils.getProjectApiRoot().discountCodes().get().executeBlocking().getBody().getCount())
218218
.isZero());

commercetools/commercetools-sdk-java-api/src/integrationTest/java/commercetools/cart_discount/CartDiscountIntegrationTests.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
package commercetools.cart_discount;
33

4+
import static cleanup.DeleteEverythingIntegrationTest.deleteAllCartDiscounts;
45
import static commercetools.cart_discount.CartDiscountFixtures.*;
56
import static commercetools.type.TypeFixtures.getFieldName;
67

@@ -16,10 +17,18 @@
1617
import commercetools.utils.CommercetoolsTestUtils;
1718

1819
import org.assertj.core.api.Assertions;
20+
import org.junit.jupiter.api.AfterAll;
21+
import org.junit.jupiter.api.BeforeAll;
1922
import org.junit.jupiter.api.Test;
2023

2124
public class CartDiscountIntegrationTests {
2225

26+
@BeforeAll
27+
@AfterAll
28+
public static void deleteCartDiscounts() {
29+
deleteAllCartDiscounts();
30+
}
31+
2332
@Test
2433
public void ref() {
2534
Optional<ReferenceTypeId> optional = ReferenceTypeId.findEnumViaJsonName("product-type");

0 commit comments

Comments
 (0)