BAEL-4686: fixed review comments
This commit is contained in:
parent
2f42035fb5
commit
a07e23dddd
|
@ -13,7 +13,7 @@ import org.junit.Test;
|
|||
public class NullAllowInMapUnitTest {
|
||||
|
||||
@Test
|
||||
public void allowNullKey_In_HashMapBackedSynchronizedMap() {
|
||||
public void givenHashMapBackedSynchronizedMap_whenNullAsKey_thenNoError() {
|
||||
Map<String, Integer> map = Collections
|
||||
.synchronizedMap(new HashMap<String, Integer>());
|
||||
map.put(null, 1);
|
||||
|
@ -22,14 +22,14 @@ public class NullAllowInMapUnitTest {
|
|||
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void allowNullKey_In_TreeMapBackedSynchronizedMap() {
|
||||
public void givenTreeMapBackedSynchronizedMap_whenNullAsKey_thenException() {
|
||||
Map<String, Integer> map = Collections.synchronizedMap(new TreeMap<String, Integer>());
|
||||
map.put(null, 1);
|
||||
Assert.assertTrue(map.get(null).equals(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void allowNullKey_In_LinkedHashMapBackedSynchronizedMap() {
|
||||
public void givenLinkedHashMapBackedSynchronizedMap_whenNullAsKey_thenNoError() {
|
||||
Map<String, Integer> map = Collections
|
||||
.synchronizedMap(new LinkedHashMap<String, Integer>());
|
||||
map.put(null, 1);
|
||||
|
@ -37,27 +37,27 @@ public class NullAllowInMapUnitTest {
|
|||
}
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void allowNullKey_In_ConcurrentHasMap() {
|
||||
public void givenConcurrentHasMap_whenNullAsKey_thenException() {
|
||||
Map<String, Integer> map = new ConcurrentHashMap<>();
|
||||
map.put(null, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void allowNullValue_In_HashMapBackedSynchronizedMap() {
|
||||
public void givenHashMapBackedSynchronizedMap_whenNullAsValue_thenNoError() {
|
||||
Map<String, Integer> map = Collections.synchronizedMap(new HashMap<String, Integer>());
|
||||
map.put("1", null);
|
||||
Assert.assertNull(map.get("1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void allowNullValue_In_TreeMapBackedSynchronizedMap() {
|
||||
public void givenTreeMapBackedSynchronizedMap_whenNullAsValue_thenNoError() {
|
||||
Map<String, Integer> map = Collections.synchronizedMap(new TreeMap<String, Integer>());
|
||||
map.put("1", null);
|
||||
Assert.assertNull(map.get("1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void allowNullValue_In_LinkedHashSynchronizedMap() {
|
||||
public void givenLinkedHashMapBackedSynchronizedMap_whenNullAsValue_thenNoError() {
|
||||
Map<String, Integer> map = Collections
|
||||
.synchronizedMap(new LinkedHashMap<String, Integer>());
|
||||
map.put("1", null);
|
||||
|
@ -65,7 +65,7 @@ public class NullAllowInMapUnitTest {
|
|||
}
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void allowNullValue_In_ConcurrentHasMap() {
|
||||
public void givenConcurrentHasMap_whenNullAsValue_thenException() {
|
||||
Map<String, Integer> map = new ConcurrentHashMap<>();
|
||||
map.put("1", null);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue