### Question:
DefaultCapabilityManager implements ICapabilityManager { @Override public Set<String> listCapabilities() { Set<String> capabilities = new HashSet<String>(); for ( ICapabilityProvider iCapabilityProvider : providers.values() ) { Set<String> caps = iCapabilityProvider.listCapabilities(); if ( caps != null ) { capabilities.addAll( caps ); } } return capabilities; } protected  DefaultCapabilityManager(); static DefaultCapabilityManager getInstance(); void registerCapabilityProvider( ICapabilityProvider provider ); @Override Set<String> listProviders(); @Override ICapabilityProvider getProvider( String id ); @Override String getId(); @Override Set<String> listCapabilities(); @Override ICapability getCapabilityById( String id ); @Override boolean capabilityExist( String id ); @Override Set<ICapability> getAllCapabilities(); static final String ID; }### Answer:
@Test public void testListCapabilities() throws Exception { ICapabilityProvider iCapabilityProvider = mock( ICapabilityProvider.class ); when(iCapabilityProvider.getId()).thenReturn( "test" ); HashSet<String> inCapabilities = new HashSet<String>( Arrays.asList( "one", "two", "three" ) ); when(iCapabilityProvider.listCapabilities()).thenReturn( inCapabilities ); manager.registerCapabilityProvider( iCapabilityProvider ); Set<String> capabilities = manager.listCapabilities(); assertEquals(3, capabilities.size()); assertTrue( Arrays.equals( capabilities.toArray(), inCapabilities.toArray() )); }