MultiAttributeProvider extends AbstractAttributeProvider { @Pure @Override public Map<AttributeType, Collection<Attribute>> getAllAttributesByType() { final Map<AttributeType, Collection<Attribute>> map = new TreeMap<>(); Attribute newAttr; for (final String name : getAllAttributeNames()) { if (name != null) { newAttr = extract(name); if (newAttr != null) { Collection<Attribute> list = map.get(newAttr.getType()); if (list == null) { list = new ArrayList<>(); map.put(newAttr.getType(), list); } list.add(newAttr); } } } return map; }  @Override void toMap(Map<String, Object> mapToFill); boolean addAttributeContainer(AttributeProvider container); boolean removeAttributeContainer(AttributeProvider container); @Pure int getAttributeContainerCount(); @Pure @Override MultiAttributeProvider clone(); @Override void freeMemory(); @Pure @Override Collection<Attribute> getAllAttributes(); @Pure @Override Map<AttributeType, Collection<Attribute>> getAllAttributesByType(); @Pure @Override AttributeValue getAttribute(String name); @Pure @Override AttributeValue getAttribute(String name, AttributeValue defaultValue); @Pure @Override int getAttributeCount(); @Pure @Override Collection<String> getAllAttributeNames(); @Pure @Override Attribute getAttributeObject(String name); @Pure @Override boolean hasAttribute(String name);  }
@Test public void testGetAllAttributesByType() { Map<AttributeType,Collection<Attribute>> attrsbytype = this.container.getAllAttributesByType(); assertNotNull(attrsbytype); assertEquals(5, attrsbytype.size()); Collection<Attribute> attrs; attrs = attrsbytype.get(AttributeType.BOOLEAN); assertNotNull(attrs); assertEquals(1, attrs.size()); assertEpsilonEquals(Arrays.asList( makeUninitialized("A", AttributeType.BOOLEAN) ), attrs); attrs = attrsbytype.get(AttributeType.DATE); assertNull(attrs); attrs = attrsbytype.get(AttributeType.INTEGER); assertNotNull(attrs); assertEquals(1, attrs.size()); assertEpsilonEquals(Arrays.asList( new AttributeImpl("B", 1) ), attrs); attrs = attrsbytype.get(AttributeType.OBJECT); assertNotNull(attrs); assertEquals(1, attrs.size()); assertEpsilonEquals(Arrays.asList( makeUninitialized("E", AttributeType.OBJECT) ), attrs); attrs = attrsbytype.get(AttributeType.POINT); assertNull(attrs); attrs = attrsbytype.get(AttributeType.POINT3D); assertNull(attrs); attrs = attrsbytype.get(AttributeType.POLYLINE); assertNull(attrs); attrs = attrsbytype.get(AttributeType.POLYLINE3D); assertNull(attrs); attrs = attrsbytype.get(AttributeType.REAL); assertNull(attrs); attrs = attrsbytype.get(AttributeType.STRING); assertNotNull(attrs); assertEquals(4, attrs.size()); assertEpsilonEquals(Arrays.asList( makeUninitialized("D", AttributeType.STRING), makeUninitialized("Z1", AttributeType.STRING), makeUninitialized("Z2", AttributeType.STRING), makeUninitialized("Z3", AttributeType.STRING) ), attrs); attrs = attrsbytype.get(AttributeType.TIMESTAMP); assertNull(attrs); attrs = attrsbytype.get(AttributeType.URI); assertNull(attrs); attrs = attrsbytype.get(AttributeType.URL); assertNotNull(attrs); assertEquals(1, attrs.size()); assertEpsilonEquals(Arrays.asList( makeUninitialized("C", AttributeType.URL) ), attrs); attrs = attrsbytype.get(AttributeType.UUID); assertNull(attrs); }