### Question:
AbstractTwoLevelMap { public V getItem(final K key1, final K key2) { final Map<K, V> keyOneValues = this.getItems(key1); return keyOneValues.computeIfAbsent(key2, k -> createValue()); }  V getItem(final K key1, final K key2); Map<K, V> getItems(final K key); void remove(final K key); Set<K> keySet();  }### Answer:
@Test public void previouslyUnknownValueCanBeRetrieved() { final AbstractTwoLevelMap<String, MockValue> map = new MockTwoLevelMap(); final MockValue value = map.getItem("foo", "bar"); MatcherAssert.assertThat(value, IsNull.notNullValue()); }
@Test public void sameValueIsReturnedForSameKeys() { final AbstractTwoLevelMap<String, MockValue> map = new MockTwoLevelMap(); final MockValue value1 = map.getItem("foo", "bar"); final MockValue value2 = map.getItem("foo", "bar"); MatcherAssert.assertThat(value2, IsSame.sameInstance(value1)); }
@Test public void valueIsDirectional() { final AbstractTwoLevelMap<String, MockValue> map = new MockTwoLevelMap(); final MockValue value1 = map.getItem("foo", "bar"); final MockValue value2 = map.getItem("bar", "foo"); MatcherAssert.assertThat(value2, IsNot.not(IsSame.sameInstance(value1))); }