ResourceGroup { public boolean addResource(Resource resource) { if (resource.getParserClass() == null) { resourcesNameMap.put(resource.getName(), resource); return true; } else { Class resourceParserClass = resource.getParserClass(); if (resourceParserClass != null) { resourcesClassMap.put(resourceParserClass, resource); resourcesNameMap.put(resource.getName(), resource); return true; } } return false; } ResourceGroup(String groupName, Class<? extends ResourceGroupParser> resourceGroupParserClass); String getName(); Class<? extends ResourceGroupParser> getParserClass(); boolean addResource(Resource resource); Resource getResource(Class<? extends ResourceParser> clazz); Resource getResource(String resourceName); @Override String toString();  }
@Test public void testAddResource() { ResourceGroup instance = new ResourceGroup("wibble", TestResourceGroupParser.class); Resource resource = new Resource("Clive"); resource.setParserClass(ResourceParser.class); assertTrue(instance.addResource(resource)); }
@Test public void testAddResourceNoParserClass() { ResourceGroup instance = new ResourceGroup("wibble", TestResourceGroupParser.class); Resource resource = new Resource("Dave"); resource.setParserClass(null); assertTrue(instance.addResource(resource)); }