mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/ccomms/TestTransportLayerMessageService.java
@Test
    public void testIsAvailableIllegalException() throws CCommException, IOException
    {
        IsAvailableRequestData request = IsAvailableRequestData.newBuilder()
                .setUuid(SharedMessageUtils.convertUUIDToProtoUUID(testUuid))
                .setAddress("finn")
                .build();
        
        TransportLayerNamespace transportMessage = TransportLayerNamespace.newBuilder()
                .setType(TransportLayerMessageType.IsAvailableRequest)
                .setData(request.toByteString())
                .build();
        
        TerraHarvestPayload payload = createPayload(transportMessage);
        TerraHarvestMessage message = createTransportLayerMessage(transportMessage);
        
        // mock the channel the message came from
        RemoteChannel channel = mock(RemoteChannel.class);
        
        // mock the address
        when(m_AddressManagerService.getOrCreateAddress("finn")).thenThrow(new CCommException(FormatProblem.OTHER));
        
        m_SUT.handleMessage(message, payload, channel);
         
        verify(m_MessageFactory).createBaseErrorMessage(eq(message), 
                eq(ErrorCode.CCOMM_ERROR), Mockito.anyString());
        verify(m_ResponseWrapper).queue(channel);
    }
/**
     * Test is available when a CComException is thrown. 
     * Verify error message.
     */
Test is available when a CComException is thrown.
Verify error message.
Test is available when a CComException is thrown . Verify error message .
@Test
    public void testIsAvailableIllegalException() throws CCommException, IOException
    {
        IsAvailableRequestData request = IsAvailableRequestData.newBuilder()
                .setUuid(SharedMessageUtils.convertUUIDToProtoUUID(testUuid))
                .setAddress("finn")
                .build();
        TransportLayerNamespace transportMessage = TransportLayerNamespace.newBuilder()
                .setType(TransportLayerMessageType.IsAvailableRequest)
                .setData(request.toByteString())
                .build();
        TerraHarvestPayload payload = createPayload(transportMessage);
        TerraHarvestMessage message = createTransportLayerMessage(transportMessage);
        RemoteChannel channel = mock(RemoteChannel.class);
        when(m_AddressManagerService.getOrCreateAddress("finn")).thenThrow(new CCommException(FormatProblem.OTHER));
        m_SUT.handleMessage(message, payload, channel);
        verify(m_MessageFactory).createBaseErrorMessage(eq(message), 
                eq(ErrorCode.CCOMM_ERROR), Mockito.anyString());
        verify(m_ResponseWrapper).queue(channel);
    }
@ Test public void testIsAvailableIllegalException ( ) throws CCommException , IOException { IsAvailableRequestData request = IsAvailableRequestData . newBuilder ( ) . setUuid ( SharedMessageUtils . convertUUIDToProtoUUID ( testUuid ) ) . setAddress ( "finn" ) . build ( ) ; TransportLayerNamespace transportMessage = TransportLayerNamespace . newBuilder ( ) . setType ( TransportLayerMessageType . IsAvailableRequest ) . setData ( request . toByteString ( ) ) . build ( ) ; TerraHarvestPayload payload = createPayload ( transportMessage ) ; TerraHarvestMessage message = createTransportLayerMessage ( transportMessage ) ; RemoteChannel channel = mock ( RemoteChannel . class ) ; when ( m_AddressManagerService . getOrCreateAddress ( "finn" ) ) . thenThrow ( new CCommException ( FormatProblem . OTHER ) ) ; m_SUT . handleMessage ( message , payload , channel ) ; verify ( m_MessageFactory ) . createBaseErrorMessage ( eq ( message ) , eq ( ErrorCode . CCOMM_ERROR ) , Mockito . anyString ( ) ) ; verify ( m_ResponseWrapper ) . queue ( channel ) ; }
Test is available when a CComException is thrown.
Test is available when a CComException is thrown .
// mock the channel the message came from // mock the address