|
1 | 1 |
|
2 | 2 | package commercetools.cart; |
3 | 3 |
|
| 4 | +import static commercetools.cart.CartsFixtures.createCart; |
| 5 | +import static commercetools.cart.CartsFixtures.deleteCart; |
| 6 | +import static commercetools.category.CategoryFixtures.withCategory; |
| 7 | +import static commercetools.product.ProductFixtures.*; |
| 8 | +import static commercetools.product_type.ProductTypeFixtures.withProductType; |
| 9 | +import static commercetools.tax_category.TaxCategoryFixtures.withTaxCategory; |
| 10 | + |
4 | 11 | import java.util.ArrayList; |
5 | 12 | import java.util.List; |
6 | 13 |
|
|
14 | 21 | import org.assertj.core.api.Assertions; |
15 | 22 | import org.junit.jupiter.api.Test; |
16 | 23 |
|
17 | | -import static commercetools.cart.CartsFixtures.createCart; |
18 | | -import static commercetools.cart.CartsFixtures.deleteCart; |
19 | | -import static commercetools.category.CategoryFixtures.withCategory; |
20 | | -import static commercetools.product.ProductFixtures.*; |
21 | | -import static commercetools.product_type.ProductTypeFixtures.withProductType; |
22 | | -import static commercetools.tax_category.TaxCategoryFixtures.withTaxCategory; |
23 | | - |
24 | 24 | public class CartIntegrationTests { |
25 | 25 | @Test |
26 | 26 | public void queryByCustomerId() { |
@@ -87,28 +87,27 @@ public void getByCustomerId() { |
87 | 87 |
|
88 | 88 | @Test |
89 | 89 | public void bigCart() { |
90 | | - withTaxCategory(taxCategory -> withCategory(category -> withProductType(createProductTypeDraft(), productType -> { |
91 | | - List<Product> products = new ArrayList<>(); |
92 | | - for(int i = 0; i < 100; i++) { |
93 | | - products.add(createProduct(productType, category, taxCategory, true)); |
94 | | - } |
| 90 | + withTaxCategory( |
| 91 | + taxCategory -> withCategory(category -> withProductType(createProductTypeDraft(), productType -> { |
| 92 | + List<Product> products = new ArrayList<>(); |
| 93 | + for (int i = 0; i < 100; i++) { |
| 94 | + products.add(createProduct(productType, category, taxCategory, true)); |
| 95 | + } |
95 | 96 |
|
96 | | - CartDraftBuilder cartDraft = CartDraft.builder() |
97 | | - .currency("EUR") |
98 | | - .country("DE"); |
99 | | - products.forEach(product -> cartDraft.plusLineItems(lineItemDraftBuilder -> lineItemDraftBuilder |
100 | | - .sku(product.getMasterData().getCurrent().getMasterVariant().getSku()) |
101 | | - )); |
| 97 | + CartDraftBuilder cartDraft = CartDraft.builder().currency("EUR").country("DE"); |
| 98 | + products.forEach(product -> cartDraft.plusLineItems(lineItemDraftBuilder -> lineItemDraftBuilder |
| 99 | + .sku(product.getMasterData().getCurrent().getMasterVariant().getSku()))); |
102 | 100 |
|
103 | | - try { |
104 | | - final long startTime = System.currentTimeMillis(); |
105 | | - Cart cart = createCart(cartDraft.build()); |
106 | | - final long executionTime = System.currentTimeMillis() - startTime; |
107 | | - deleteCart(cart.getId(), cart.getVersion()); |
108 | | - } finally { |
109 | | - products.forEach(ProductFixtures::deleteProduct); |
110 | | - } |
111 | | - }))); |
| 101 | + try { |
| 102 | + final long startTime = System.currentTimeMillis(); |
| 103 | + Cart cart = createCart(cartDraft.build()); |
| 104 | + final long executionTime = System.currentTimeMillis() - startTime; |
| 105 | + deleteCart(cart.getId(), cart.getVersion()); |
| 106 | + } |
| 107 | + finally { |
| 108 | + products.forEach(ProductFixtures::deleteProduct); |
| 109 | + } |
| 110 | + }))); |
112 | 111 | } |
113 | 112 |
|
114 | 113 | } |
0 commit comments