### Question:
ThreadLocalMap extends InheritableThreadLocal<Map<K, V>> { @Override protected final Map<K, V> childValue(Map<K, V> parentValue) { if (parentValue == null) { return null; } else { return new HashMap<>(parentValue); } }    }### Answer:
@Test public void shouldCreateChildWithNull() { assertThat(new ThreadLocalMap<String, String>().childValue(null), is(nullValue())); }
@Test public void shouldCreateChildWithCopyOfHashMap() { final Map<String, String> map = new HashMap<>(); map.put("A", "vA"); final Map<String, String> childValueMap = new ThreadLocalMap<String, String>().childValue(map); assertThat(childValueMap, equalTo(map)); assertThat(childValueMap, is(not(sameInstance(map)))); }