CompositeResourceManager implements ResourceManager { @Override public void close() throws IOException { for (ResourceManager resourceManager : this.resourceManagers) { resourceManager.close(); } } CompositeResourceManager(ResourceManager... resourceManagers); @Override void close(); @Override Resource getResource(String path); @Override boolean isResourceChangeListenerSupported(); @Override void registerResourceChangeListener(ResourceChangeListener listener); @Override void removeResourceChangeListener(ResourceChangeListener listener);  }
@Test public void testClose() throws IOException { ResourceManager resourceManager1 = mock(ResourceManager.class); ResourceManager resourceManager2 = mock(ResourceManager.class); ResourceManager resourceManager3 = mock(ResourceManager.class); CompositeResourceManager compositeResourceManager = new CompositeResourceManager( resourceManager1, resourceManager2, resourceManager3 ); compositeResourceManager.close(); verify(resourceManager1).close(); verify(resourceManager2).close(); verify(resourceManager3).close(); }