SimpleNullableMapAttribute extends SimpleNullableAttribute<Map, A> { public SimpleNullableMapAttribute(K mapKey, Class<A> mapValueType) { super(Map.class, mapValueType, mapKey.toString()); this.mapKey = mapKey; } SimpleNullableMapAttribute(K mapKey, Class<A> mapValueType);  SimpleNullableMapAttribute(K mapKey, Class<A> mapValueType, String attributeName); @Override A getValue(Map map, QueryOptions queryOptions); @Override int hashCode(); @Override boolean canEqual(Object other); @Override boolean equals(Object other);  }
@Test @SuppressWarnings("unchecked") public void testSimpleNullableMapAttribute() { Map map = new HashMap(); map.put("foo", 1); map.put("bar", 2.5); map.put(1.5F, "baz"); Attribute<Map, Integer> FOO = mapAttribute("foo", Integer.class); Attribute<Map, Double> BAR = mapAttribute("bar", Double.class); Attribute<Map, String> ONE_POINT_FIVE = mapAttribute(1.5F, String.class); Attribute<Map, String> NON_EXISTENT = mapAttribute("foobar", String.class); Assert.assertEquals("[1]", Iterables.toString(FOO.getValues(map, noQueryOptions()))); Assert.assertEquals("[2.5]", Iterables.toString(BAR.getValues(map, noQueryOptions()))); Assert.assertEquals("[baz]", Iterables.toString(ONE_POINT_FIVE.getValues(map, noQueryOptions()))); Assert.assertEquals("[]", Iterables.toString(NON_EXISTENT.getValues(map, noQueryOptions()))); }