### Question:
DefaultCapabilityManager implements ICapabilityManager { @Override public boolean capabilityExist( String id ) { for ( ICapabilityProvider iCapabilityProvider : providers.values() ) { if ( iCapabilityProvider.capabilityExist( id ) ) { return true; } } return false; } 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 testCapabilityExist() throws Exception { ICapabilityProvider iCapabilityProvider = mock( ICapabilityProvider.class ); when(iCapabilityProvider.capabilityExist("foo")).thenReturn( true); manager.registerCapabilityProvider( iCapabilityProvider ); boolean exists = manager.capabilityExist( "foo" ); assertSame( true, exists ); boolean doesNotExist = manager.capabilityExist( "bad" ); assertSame( false, doesNotExist ); }