MessagingMngrImpl implements IMessagingMngr { @Override public void checkMessagingConfiguration() throws IOException { String msg = null; if( this.messagingClient == null ) msg = "The DM was not started."; else if( ! this.messagingClient.hasValidClient()) msg = "The DM's configuration is invalid. Please, review the messaging settings."; if( msg != null ) { this.logger.warning( msg ); throw new IOException( msg ); } }  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( expected = IOException.class ) public void testCheckMessagingConfiguration_noConfiguration() throws Exception { this.mngr = new MessagingMngrImpl(); this.mngr.checkMessagingConfiguration(); }
@Test( expected = IOException.class ) public void testCheckMessagingConfiguration_invalidConfiguration() throws Exception { Mockito.when( this.msgClient.hasValidClient()).thenReturn( false ); this.mngr.checkMessagingConfiguration(); }
@Test public void testCheckMessagingConfiguration() throws Exception { Mockito.when( this.msgClient.hasValidClient()).thenReturn( true ); this.mngr.checkMessagingConfiguration(); }