Changing test names and updating maven dependency

This commit is contained in:
Himanshu Mantri 2017-06-29 13:05:50 +05:30
parent e5f050aeb8
commit cfb7e8889d
2 changed files with 6 additions and 6 deletions

View File

@ -17,7 +17,7 @@
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId> <artifactId>commons-collections4</artifactId>
<version>4.0</version> <version>4.1</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/junit/junit --> <!-- https://mvnrepository.com/artifact/junit/junit -->

View File

@ -35,9 +35,8 @@ public class CollectionUtilsGuideTest {
@Test @Test
public void givenList_WhenAddIgnoreNull_thenNoNullAdded() { public void givenList_WhenAddIgnoreNull_thenNoNullAdded() {
List<String> list = Arrays.asList("x", "y", "z"); CollectionUtils.addIgnoreNull(list1, null);
CollectionUtils.addIgnoreNull(list, null); assertFalse(list1.contains(null));
assertFalse(list.contains(null));
} }
@Test @Test
@ -98,14 +97,15 @@ public class CollectionUtilsGuideTest {
} }
@Test @Test
public void givenEmptyList_WhenCheckedIsEmpty_thenTrue() { public void givenNonEmptyList_WhenCheckedIsNotEmpty_thenTrue() {
List<Customer> emptyList = new ArrayList<Customer>(); List<Customer> emptyList = new ArrayList<Customer>();
List<Customer> nullList = null; List<Customer> nullList = null;
//Very handy at times where we want to check if a collection is not null and not empty too. //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 //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(nullList));
assertTrue(CollectionUtils.isEmpty(emptyList));
} }
@Test @Test