Skip to content

Commit 7a77016

Browse files
BAEL-965 - adding changes as per Grzegorz comments
1 parent 0f49c26 commit 7a77016

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

‎libraries/src/main/java/com/baeldung/commons/collectionutil/Address.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
public class Address {
44

5-
String locality;
6-
String city;
7-
String zip;
5+
private String locality;
6+
private String city;
7+
private String zip;
88

99
public String getLocality() {
1010
return locality;

‎libraries/src/main/java/com/baeldung/commons/collectionutil/Customer.java‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
public class Customer implements Comparable<Customer> {
44

5-
Integer id;
6-
String name;
7-
Long phone;
8-
String locality;
9-
String city;
10-
String zip;
5+
private Integer id;
6+
private String name;
7+
private Long phone;
8+
private String locality;
9+
private String city;
10+
private String zip;
1111

1212
public Integer getId() {
1313
return id;

‎libraries/src/test/java/com/baeldung/commons/collections/CollectionUtilsGuideTest.java‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import java.util.*;
1414

15+
import static org.junit.Assert.assertEquals;
1516
import static org.junit.Assert.assertFalse;
1617
import static org.junit.Assert.assertTrue;
1718

@@ -45,6 +46,8 @@ public void givenList_whenAddIgnoreNull_thenNoNullAdded() {
4546
@Test
4647
public void givenTwoSortedLists_whenCollated_thenSorted() {
4748
List<Customer> sortedList = CollectionUtils.collate(list1, list2);
49+
50+
assertEquals(6, sortedList.size());
4851
assertTrue(sortedList.get(0).getName().equals("Bob"));
4952
assertTrue(sortedList.get(2).getName().equals("Daniel"));
5053
}
@@ -61,7 +64,7 @@ public void givenListOfCustomers_whenTransformed_thenListOfAddress() {
6164
}
6265

6366
@Test
64-
public void givenCustomerList_WhenFiltered_thenCorrectSize() {
67+
public void givenCustomerList_whenFiltered_thenCorrectSize() {
6568

6669
boolean isModified = CollectionUtils.filter(linkedList1, customer -> Arrays.asList("Daniel","Kyle").contains(customer.getName()));
6770

0 commit comments

Comments
 (0)