tests has been added and split
This commit is contained in:
parent
b2bc2dc004
commit
da97125e20
|
@ -15,7 +15,37 @@ public class CaseInsensitiveMapUnitTest {
|
|||
treeMap.put("abc", 1);
|
||||
treeMap.put("ABC", 2);
|
||||
|
||||
assertEquals(treeMap.size(), 1);
|
||||
assertEquals(1, treeMap.size());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenCommonsCaseInsensitiveMap_whenTwoEntriesAdded_thenSizeIsOne(){
|
||||
CaseInsensitiveMap<String, Integer> commonsHashMap = new CaseInsensitiveMap<>();
|
||||
commonsHashMap.put("abc", 1);
|
||||
commonsHashMap.put("ABC", 2);
|
||||
|
||||
assertEquals(1, commonsHashMap.size());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenLinkedCaseInsensitiveMap_whenTwoEntriesAdded_thenSizeIsOne(){
|
||||
LinkedCaseInsensitiveMap<Integer> linkedHashMap = new LinkedCaseInsensitiveMap<>();
|
||||
linkedHashMap.put("abc", 1);
|
||||
linkedHashMap.put("ABC", 2);
|
||||
|
||||
assertEquals(1, linkedHashMap.size());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenCaseInsensitiveTreeMap_whenSameEntryAdded_thenValueUpdated(){
|
||||
TreeMap<String, Integer> treeMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
treeMap.put("abc", 1);
|
||||
treeMap.put("ABC", 2);
|
||||
|
||||
Assert.assertEquals((Integer)2, treeMap.get("aBc"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -24,7 +54,34 @@ public class CaseInsensitiveMapUnitTest {
|
|||
commonsHashMap.put("abc", 1);
|
||||
commonsHashMap.put("ABC", 2);
|
||||
|
||||
Assert.assertEquals(commonsHashMap.get("aBc"), (Integer)2);
|
||||
Assert.assertEquals((Integer)2, commonsHashMap.get("aBc"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenLinkedCaseInsensitiveMap_whenSameEntryAdded_thenValueUpdated(){
|
||||
LinkedCaseInsensitiveMap<Integer> linkedHashMap = new LinkedCaseInsensitiveMap<>();
|
||||
linkedHashMap.put("abc", 1);
|
||||
linkedHashMap.put("ABC", 2);
|
||||
|
||||
Assert.assertEquals((Integer)2, linkedHashMap.get("aBc"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenCaseInsensitiveTreeMap_whenEntryRemoved_thenSizeIsZero(){
|
||||
TreeMap<String, Integer> treeMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
treeMap.put("abc", 3);
|
||||
treeMap.remove("aBC");
|
||||
|
||||
Assert.assertEquals(0, treeMap.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenCommonsCaseInsensitiveMap_whenEntryRemoved_thenSizeIsZero(){
|
||||
CaseInsensitiveMap<String, Integer> commonsHashMap = new CaseInsensitiveMap<>();
|
||||
commonsHashMap.put("abc", 3);
|
||||
commonsHashMap.remove("aBC");
|
||||
|
||||
Assert.assertEquals(0, commonsHashMap.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -33,6 +90,6 @@ public class CaseInsensitiveMapUnitTest {
|
|||
linkedHashMap.put("abc", 3);
|
||||
linkedHashMap.remove("aBC");
|
||||
|
||||
Assert.assertEquals(linkedHashMap.size(), 0);
|
||||
Assert.assertEquals(0, linkedHashMap.size());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue