@Test public void testAddCategory() { Resource resource = new ResourceImpl(Resource.Type.Cluster); resource.addCategory("c1"); resource.addCategory("c2/sub2"); resource.addCategory("c3/sub3/sub3a"); Assert.assertTrue(resource.getPropertiesMap().containsKey("c1")); Assert.assertTrue(resource.getPropertiesMap().containsKey("c2/sub2")); Assert.assertTrue(resource.getPropertiesMap().containsKey("c3/sub3/sub3a")); }
@Override public void addCategory(String id) { String categoryKey = getCategoryKey(id); if (!propertiesMap.containsKey(categoryKey)) { propertiesMap.put(categoryKey, new HashMap<String, Object>()); } }
ResourceImpl implements Resource { @Override public void addCategory(String id) { String categoryKey = getCategoryKey(id); if (!propertiesMap.containsKey(categoryKey)) { propertiesMap.put(categoryKey, new HashMap<String, Object>()); } } }
ResourceImpl implements Resource { @Override public void addCategory(String id) { String categoryKey = getCategoryKey(id); if (!propertiesMap.containsKey(categoryKey)) { propertiesMap.put(categoryKey, new HashMap<String, Object>()); } } ResourceImpl(Type type);  ResourceImpl(Resource resource);  ResourceImpl(Resource resource, Set<String> propertyIds); }
ResourceImpl implements Resource { @Override public void addCategory(String id) { String categoryKey = getCategoryKey(id); if (!propertiesMap.containsKey(categoryKey)) { propertiesMap.put(categoryKey, new HashMap<String, Object>()); } } ResourceImpl(Type type);  ResourceImpl(Resource resource);  ResourceImpl(Resource resource, Set<String> propertyIds); @Override Type getType(); @Override Map<String, Map<String, Object>> getPropertiesMap(); @Override void setProperty(String id, Object value); @Override void addCategory(String id); @Override Object getPropertyValue(String id); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
ResourceImpl implements Resource { @Override public void addCategory(String id) { String categoryKey = getCategoryKey(id); if (!propertiesMap.containsKey(categoryKey)) { propertiesMap.put(categoryKey, new HashMap<String, Object>()); } } ResourceImpl(Type type);  ResourceImpl(Resource resource);  ResourceImpl(Resource resource, Set<String> propertyIds); @Override Type getType(); @Override Map<String, Map<String, Object>> getPropertiesMap(); @Override void setProperty(String id, Object value); @Override void addCategory(String id); @Override Object getPropertyValue(String id); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }