Maps { static <K, V> Gen<Map<K, V>> boundedMapsOf(Gen<K> kg, Gen<V> vg, Gen<Integer> sizes) { return mapsOf(kg, vg, defaultMap(), sizes); }  static Collector<Map.Entry<K, V>, ?, Map<K, V>> defaultMap();  }
@Test public void mapsUseSuppliedKeysAndValues() { Gen<String> keys = pick(Arrays.asList("1","2","3")); Gen<Map<String, String>> testee = Maps.boundedMapsOf(keys, constant("aValue"), constant(1)); assertThatGenerator(testee).generatesAllOf(map("1", "aValue"), map("2", "aValue"), map("3", "aValue")); }
@Test public void mapsHaveReadableDescription() { Gen<Map<String, String>> testee = Maps.boundedMapsOf(constant("aKey"), constant("aValue"), constant(1)); Map<String,String> aMap = new HashMap<>(); aMap.put("a", "fish"); aMap.put("b", "dish"); String actual = testee.asString(aMap); assertThat(actual).isEqualToIgnoringWhitespace("[(a,fish), (b,dish)]"); }