mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/TestMessageRouterImpl.java
@Test
    public void testInvalidRemoteMessageService() throws InvalidProtocolBufferException, InvalidKeySignatureException
    {
        TerraHarvestMessage baseMessage = TerraHarvestMessageHelper.createBaseMessage();
        TerraHarvestPayload payLoadTest = TerraHarvestPayload.parseFrom(baseMessage.getTerraHarvestPayload()) ;
                
        // mock the channel the message came from
        RemoteChannel channel = mock(RemoteChannel.class);
        when(channel.queueMessage(Mockito.any(TerraHarvestMessage.class))).thenReturn(true);
        
        //decryption call
        when(m_EcryptService.decryptRemoteMessage(Mockito.any(TerraHarvestMessage.class))).
            thenReturn(payLoadTest);
        
        // replay
        m_SUT.handleMessage(baseMessage, channel);
        
        TerraHarvestMessage testMessage = TerraHarvestMessageUtil.buildErrorResponseMessage(baseMessage, 
                ErrorCode.NO_MESSAGE_SERVICE, "No remote message service found to handle the message: " + 
                payLoadTest.getNamespace());
        
        // verify error response is queued from the channel
        verify(channel).queueMessage(testMessage);
    }
/**
     * Verify if a message service is not set that an error response is queued to the channel that was
     * attempting to handle a message.
     *  
     */
Verify if a message service is not set that an error response is queued to the channel that was
attempting to handle a message.
Verify if a message service is not set that an error response is queued to the channel that was attempting to handle a message .
@Test
    public void testInvalidRemoteMessageService() throws InvalidProtocolBufferException, InvalidKeySignatureException
    {
        TerraHarvestMessage baseMessage = TerraHarvestMessageHelper.createBaseMessage();
        TerraHarvestPayload payLoadTest = TerraHarvestPayload.parseFrom(baseMessage.getTerraHarvestPayload()) ;
        RemoteChannel channel = mock(RemoteChannel.class);
        when(channel.queueMessage(Mockito.any(TerraHarvestMessage.class))).thenReturn(true);
        when(m_EcryptService.decryptRemoteMessage(Mockito.any(TerraHarvestMessage.class))).
            thenReturn(payLoadTest);
        m_SUT.handleMessage(baseMessage, channel);
        TerraHarvestMessage testMessage = TerraHarvestMessageUtil.buildErrorResponseMessage(baseMessage, 
                ErrorCode.NO_MESSAGE_SERVICE, "No remote message service found to handle the message: " + 
                payLoadTest.getNamespace());
        verify(channel).queueMessage(testMessage);
    }
@ Test public void testInvalidRemoteMessageService ( ) throws InvalidProtocolBufferException , InvalidKeySignatureException { TerraHarvestMessage baseMessage = TerraHarvestMessageHelper . createBaseMessage ( ) ; TerraHarvestPayload payLoadTest = TerraHarvestPayload . parseFrom ( baseMessage . getTerraHarvestPayload ( ) ) ; RemoteChannel channel = mock ( RemoteChannel . class ) ; when ( channel . queueMessage ( Mockito . any ( TerraHarvestMessage . class ) ) ) . thenReturn ( true ) ; when ( m_EcryptService . decryptRemoteMessage ( Mockito . any ( TerraHarvestMessage . class ) ) ) . thenReturn ( payLoadTest ) ; m_SUT . handleMessage ( baseMessage , channel ) ; TerraHarvestMessage testMessage = TerraHarvestMessageUtil . buildErrorResponseMessage ( baseMessage , ErrorCode . NO_MESSAGE_SERVICE , "No remote message service found to handle the message: " + payLoadTest . getNamespace ( ) ) ; verify ( channel ) . queueMessage ( testMessage ) ; }
Verify if a message service is not set that an error response is queued to the channel that was
 attempting to handle a message.
Verify if a message service is not set that an error response is queued to the channel that was attempting to handle a message .
// mock the channel the message came from //decryption call // replay // verify error response is queued from the channel