MapOfSets implements MultiMap<K, V> { @Override public Collection<V> get(final K key) { return multiMap.get(key); } MapOfSets(final Map<K, Set<V>> multiMap);  MapOfSets(final Map<K, Set<V>> multiMap, final Class<? extends Set> setClass); @Override boolean put(final K key, final V value); @Override void put(final K key, final Collection<V> value); @Override Collection<V> get(final K key); @Override Set<K> keySet(); Collection<Map.Entry<K, Set<V>>> entrySet(); @Override void clear(); Map<K, Set<V>> getWrappedMap();  }
@Test public void shouldGetSetFromMap() throws StoreException { final String key = "key1"; final Set<String> set = mock(Set.class); final Map<String, Set<String>> map = mock(Map.class); final MapOfSets<String, String> mapOfSets = new MapOfSets<>(map, LinkedHashSet.class); given(map.get(key)).willReturn(set); final Collection<String> result = mapOfSets.get(key); verify(map).get(key); assertSame(set, result); }