### Question:
CommandProcessor implements RestProcessor { public void addListener( HeartbeatListener listener ) { if ( listener != null ) { listeners.add( listener ); } } CommandProcessor( final HostRegistry hostRegistry, final IdentityManager identityManager ); void addListener( HeartbeatListener listener ); void removeListener( HeartbeatListener listener ); void dispose(); @Override void handleHeartbeat( final HeartBeat heartBeat ); @Override Set<String> getRequests( final String hostId ); @Override void handleResponse( final Response response );  }### Answer:
@Test public void addListener() throws Exception { commandProcessor.addListener( heartbeatListener ); verify( listeners ).add( heartbeatListener ); }