Skip to content

Commit befbcfd

Browse files
committed
spotless: Fix code style
1 parent 4700565 commit befbcfd

2 files changed

Lines changed: 23 additions & 12 deletions

File tree

commercetools/commercetools-importapi-utils/src/main/java/com/commercetools/sdk/CustomerUtil.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ private List<StoreKeyReference> toImportApiStoreKeyReferences(
7979
}
8080

8181
private List<Integer> getAddressesIds(List<Address> addresses, List<Address> shippingAddresses) {
82-
return shippingAddresses.stream().map(a -> getAddressesId(addresses, a.getId())).filter(Objects::nonNull).toList();
82+
return shippingAddresses.stream()
83+
.map(a -> getAddressesId(addresses, a.getId()))
84+
.filter(Objects::nonNull)
85+
.toList();
8386
}
8487

8588
private Integer getAddressesId(List<Address> addresses, String addressId) {

commercetools/commercetools-importapi-utils/src/test/java/com/commercetools/sdk/CustomerUtilTest.java

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
1+
12
package com.commercetools.sdk;
23

3-
import com.commercetools.api.models.customer.Customer;
4-
import io.vrap.rmf.base.client.utils.json.JsonUtils;
5-
import org.junit.jupiter.api.Test;
4+
import static com.commercetools.sdk.TestUtils.stringFromResource;
5+
import static org.junit.jupiter.api.Assertions.*;
66

77
import java.util.List;
88

9-
import static com.commercetools.sdk.TestUtils.stringFromResource;
10-
import static org.junit.jupiter.api.Assertions.*;
9+
import com.commercetools.api.models.customer.Customer;
10+
11+
import io.vrap.rmf.base.client.utils.json.JsonUtils;
12+
13+
import org.junit.jupiter.api.Test;
1114

1215
class CustomerUtilTest {
1316
private final CustomerUtil util = new CustomerUtil();
1417

1518
@Test
1619
void shouldMapRequiredFields() {
17-
var customer = JsonUtils.fromJsonString(stringFromResource("src/test/resources/customer.example.json"), Customer.class);
20+
var customer = JsonUtils.fromJsonString(stringFromResource("src/test/resources/customer.example.json"),
21+
Customer.class);
1822
var result = util.toCustomerImport(customer);
1923

2024
assertEquals("customer-key", result.getKey());
@@ -23,16 +27,18 @@ void shouldMapRequiredFields() {
2327

2428
@Test
2529
void shouldMapCustomerGroupKeyFromExpandedObj() {
26-
var customer = JsonUtils.fromJsonString(stringFromResource("src/test/resources/customer.example.json"), Customer.class);
30+
var customer = JsonUtils.fromJsonString(stringFromResource("src/test/resources/customer.example.json"),
31+
Customer.class);
2732
var result = util.toCustomerImport(customer);
2833

2934
assertNotNull(result.getCustomerGroup());
30-
assertEquals("vip-group", result.getCustomerGroup().getKey()); // catches getId() bug
35+
assertEquals("vip-group", result.getCustomerGroup().getKey()); // catches getId() bug
3136
}
3237

3338
@Test
3439
void shouldMapAddressIndices() {
35-
var customer = JsonUtils.fromJsonString(stringFromResource("src/test/resources/customer.example.json"), Customer.class);
40+
var customer = JsonUtils.fromJsonString(stringFromResource("src/test/resources/customer.example.json"),
41+
Customer.class);
3642
var result = util.toCustomerImport(customer);
3743

3844
// addr-0 is index 0, addr-1 is index 1
@@ -44,7 +50,8 @@ void shouldMapAddressIndices() {
4450

4551
@Test
4652
void shouldMapAddresses() {
47-
var customer = JsonUtils.fromJsonString(stringFromResource("src/test/resources/customer.example.json"), Customer.class);
53+
var customer = JsonUtils.fromJsonString(stringFromResource("src/test/resources/customer.example.json"),
54+
Customer.class);
4855
var result = util.toCustomerImport(customer);
4956

5057
assertEquals(2, result.getAddresses().size());
@@ -53,7 +60,8 @@ void shouldMapAddresses() {
5360

5461
@Test
5562
void shouldHandleNullCustomerGroup() {
56-
var customer = JsonUtils.fromJsonString(stringFromResource("src/test/resources/customer.no-group.json"), Customer.class);
63+
var customer = JsonUtils.fromJsonString(stringFromResource("src/test/resources/customer.no-group.json"),
64+
Customer.class);
5765
var result = util.toCustomerImport(customer);
5866
assertNull(result.getCustomerGroup());
5967
}

0 commit comments

Comments
 (0)