Changing test names and updating maven dependency
This commit is contained in:
parent
e5f050aeb8
commit
cfb7e8889d
@ -17,7 +17,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-collections4</artifactId>
|
||||
<version>4.0</version>
|
||||
<version>4.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/junit/junit -->
|
||||
|
@ -35,9 +35,8 @@ public class CollectionUtilsGuideTest {
|
||||
|
||||
@Test
|
||||
public void givenList_WhenAddIgnoreNull_thenNoNullAdded() {
|
||||
List<String> list = Arrays.asList("x", "y", "z");
|
||||
CollectionUtils.addIgnoreNull(list, null);
|
||||
assertFalse(list.contains(null));
|
||||
CollectionUtils.addIgnoreNull(list1, null);
|
||||
assertFalse(list1.contains(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -98,14 +97,15 @@ public class CollectionUtilsGuideTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenEmptyList_WhenCheckedIsEmpty_thenTrue() {
|
||||
public void givenNonEmptyList_WhenCheckedIsNotEmpty_thenTrue() {
|
||||
List<Customer> emptyList = new ArrayList<Customer>();
|
||||
List<Customer> nullList = null;
|
||||
|
||||
//Very handy at times where we want to check if a collection is not null and not empty too.
|
||||
//isNotEmpty does the opposite. Handy because using ! operator on isEmpty makes it missable while reading
|
||||
assertTrue(CollectionUtils.isEmpty(emptyList));
|
||||
assertTrue(CollectionUtils.isNotEmpty(list1));
|
||||
assertTrue(CollectionUtils.isEmpty(nullList));
|
||||
assertTrue(CollectionUtils.isEmpty(emptyList));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user