### Question:
DefaultCapabilityManager implements ICapabilityManager { @Override public ICapability getCapabilityById( String id ) { for ( ICapabilityProvider iCapabilityProvider : providers.values() ) { ICapability capabilityById = iCapabilityProvider.getCapabilityById( id ); if ( capabilityById != null ) { return capabilityById; } } return null; } 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 testGetCapabilityById() throws Exception { ICapabilityProvider iCapabilityProvider = mock( ICapabilityProvider.class ); when(iCapabilityProvider.getId()).thenReturn( "test" ); ICapability capability = mock( ICapability.class ); when(iCapabilityProvider.getCapabilityById( "foo" )).thenReturn( capability ); manager.registerCapabilityProvider( iCapabilityProvider ); ICapability foo = manager.getCapabilityById( "foo" ); assertSame( capability, foo ); }