MessagingMngrImpl implements IMessagingMngr { @Override public void sendMessageToTheDm( Message message ) throws IOException { this.messagingClient.sendMessageToTheDm( message ); }  void setMessagingClient( RCDm messagingClient ); @Override void sendMessageSafely( ManagedApplication ma, Instance instance, Message message ); @Override void sendMessageDirectly( ManagedApplication ma, Instance scopedInstance, Message message ); @Override void sendStoredMessages( ManagedApplication ma, Instance instance ); @Override void sendMessageToTheDm( Message message ); @Override IDmClient getMessagingClient(); @Override void checkMessagingConfiguration();  }
@Test public void testSendMessageToTheDm_normal() throws Exception { Mockito.verifyZeroInteractions( this.msgClient ); this.mngr.sendMessageToTheDm( new MsgCmdRemoveInstance( "/" )); Mockito.verify( this.msgClient, Mockito.times( 1 )).sendMessageToTheDm( Mockito.any( MsgCmdRemoveInstance.class )); }
@Test( expected = IOException.class ) public void testSendMessageToTheDm_messagingError() throws Exception { Mockito.verifyZeroInteractions( this.msgClient ); Mockito.doThrow( new IOException( "for test" )).when( this.msgClient ).sendMessageToTheDm( Mockito.any( MsgCmdRemoveInstance.class )); this.mngr.sendMessageToTheDm( new MsgCmdRemoveInstance( "/" )); }