### Question:
RResourceComposite implements RResource { @Override public ResourceIdentifier getResourceIdentifier(Integer id) { for (RResource resource : resources) { ResourceIdentifier identifier = resource.getResourceIdentifier(id); if (identifier != null) { return identifier; } } return null; } RResourceComposite(RResource... resources); @Override ResourceIdentifier getResourceIdentifier(Integer id);  }### Answer:
@Test public void testComposite() { ResourceIdentifier resourceIdOne = resourceComposite.getResourceIdentifier(RTest.one.id1); ResourceIdentifier resourceIdTwo = resourceComposite.getResourceIdentifier(RTest.two.id2); assertEquals(resourceOne.getResourceIdentifier(RTest.one.id1), resourceIdOne); assertEquals(resourceTwo.getResourceIdentifier(RTest.two.id2), resourceIdTwo); assertNull(resourceComposite.getResourceIdentifier(RESOURCE_THAT_DOESNT_EXIST)); }
@Test public void testNullInput() { RResourceComposite rResourceComposite = new RResourceComposite(null, resourceOne); ResourceIdentifier resourceIdOne = rResourceComposite.getResourceIdentifier(RTest.one.id1); assertEquals(resourceOne.getResourceIdentifier(RTest.one.id1), resourceIdOne); assertNull(rResourceComposite.getResourceIdentifier(RTest.two.id2)); }
@Test public void testEmptyResourceComposite() { RResourceComposite nullResourceComposite = new RResourceComposite(); assertNull(nullResourceComposite.getResourceIdentifier(RTest.one.id1)); }