RoboconfRecoveryListener implements RecoveryListener { @Override public void handleRecovery( Recoverable recoverable ) { if( recoverable instanceof Channel ) { int channelNumber = ((Channel) recoverable).getChannelNumber(); this.logger.fine( "Connection to channel #" + channelNumber + " was recovered." ); } }  @Override void handleRecovery( Recoverable recoverable );  }
@Test public void testHandleRecovery() { RoboconfRecoveryListener listener = new RoboconfRecoveryListener(); AutorecoveringChannel ch = Mockito.mock( AutorecoveringChannel.class ); listener.handleRecovery( ch ); Mockito.verify( ch, Mockito.only()).getChannelNumber(); Recoverable recoverable = Mockito.mock( Recoverable.class ); listener.handleRecovery( recoverable ); Mockito.verifyZeroInteractions( recoverable ); }