### Question:
Resources implements Resourced { public List<ResourceDescriptor> getResourceDescriptors() { return resourceDescriptors; } Resources(final Iterable<ResourceDescriptor> resourceDescriptors); static Resources fromXml(final Element element); List<ResourceDescriptor> getResourceDescriptors(); @Deprecated List<ResourceDescriptor> getResourceDescriptors(final String type); ResourceLocation getResourceLocation(final String type, final String name); ResourceDescriptor getResourceDescriptor(final String type, final String name); static final Resources EMPTY_RESOURCES; }### Answer:
@Test public void testGetResourceDescriptorsByType() throws DocumentException, PluginParseException { final Resources resources = makeTestResources(); assertEquals(0, resources.getResourceDescriptors("blah").size()); final List velocityResources = resources.getResourceDescriptors("velocity"); assertEquals(2, velocityResources.size()); assertDescriptorMatches((ResourceDescriptor) velocityResources.get(0), "velocity", "view"); assertDescriptorMatches((ResourceDescriptor) velocityResources.get(1), "velocity", "edit"); }
@Test public void testMultipleResources() throws DocumentException, PluginParseException { final Resources resources = makeTestResources(); final List descriptors = resources.getResourceDescriptors(); assertEquals(3, descriptors.size()); assertDescriptorMatches((ResourceDescriptor) descriptors.get(0), "velocity", "view"); assertDescriptorMatches((ResourceDescriptor) descriptors.get(1), "velocity", "edit"); assertDescriptorMatches((ResourceDescriptor) descriptors.get(2), "image", "view"); }
@Test(expected = IllegalArgumentException.class) public void testNullTypeThrows() throws PluginParseException, DocumentException { final Resources resources = makeTestResources(); resources.getResourceDescriptors(null); }