mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/ccomms/TestCustomCommsMessageService.java
@Test
    public void testSetLayerNamePersist() throws IOException, IllegalArgumentException, CCommException
    {
        doThrow(new CCommException("Exception", FormatProblem.OTHER)).
            when(m_CustomCommsService).setPhysicalLinkName(testUuid, "name");

        //request to set the name of a physical link layer
        SetLayerNameRequestData request = SetLayerNameRequestData.newBuilder().
            setCommType(CommType.PhysicalLink).
            setLayerName("name").
            setUuid(SharedMessageUtils.convertUUIDToProtoUUID(testUuid)).build();
        CustomCommsNamespace namespace = CustomCommsNamespace.newBuilder().
                setData(request.toByteString()).
                setType(CustomCommsMessageType.SetLayerNameRequest).build();
        TerraHarvestPayload payload = createPayload(namespace);
        TerraHarvestMessage message = createCustomCommsMessage(namespace);

        //mock remote channel
        RemoteChannel channel = mock(RemoteChannel.class);

        //handle message
        m_SUT.handleMessage(message, payload, channel);
        
        verify(m_MessageFactory).createBaseErrorMessage(message, ErrorCode.CCOMM_ERROR, 
            "Unable to set the name for layer PhysicalLink with UUID " + testUuid.toString() + ". Exception:OTHER");
        //reused channel
        verify(m_ResponseWrapper).queue(channel);
    }
/**
     * Test set name for layers with persistence failed.
     * Verify that expected error message is sent.
     */
Test set name for layers with persistence failed.
Verify that expected error message is sent.
Test set name for layers with persistence failed . Verify that expected error message is sent .
@Test
    public void testSetLayerNamePersist() throws IOException, IllegalArgumentException, CCommException
    {
        doThrow(new CCommException("Exception", FormatProblem.OTHER)).
            when(m_CustomCommsService).setPhysicalLinkName(testUuid, "name");
        SetLayerNameRequestData request = SetLayerNameRequestData.newBuilder().
            setCommType(CommType.PhysicalLink).
            setLayerName("name").
            setUuid(SharedMessageUtils.convertUUIDToProtoUUID(testUuid)).build();
        CustomCommsNamespace namespace = CustomCommsNamespace.newBuilder().
                setData(request.toByteString()).
                setType(CustomCommsMessageType.SetLayerNameRequest).build();
        TerraHarvestPayload payload = createPayload(namespace);
        TerraHarvestMessage message = createCustomCommsMessage(namespace);
        RemoteChannel channel = mock(RemoteChannel.class);
        m_SUT.handleMessage(message, payload, channel);
        verify(m_MessageFactory).createBaseErrorMessage(message, ErrorCode.CCOMM_ERROR, 
            "Unable to set the name for layer PhysicalLink with UUID " + testUuid.toString() + ". Exception:OTHER");
        verify(m_ResponseWrapper).queue(channel);
    }
@ Test public void testSetLayerNamePersist ( ) throws IOException , IllegalArgumentException , CCommException { doThrow ( new CCommException ( "Exception" , FormatProblem . OTHER ) ) . when ( m_CustomCommsService ) . setPhysicalLinkName ( testUuid , "name" ) ; SetLayerNameRequestData request = SetLayerNameRequestData . newBuilder ( ) . setCommType ( CommType . PhysicalLink ) . setLayerName ( "name" ) . setUuid ( SharedMessageUtils . convertUUIDToProtoUUID ( testUuid ) ) . build ( ) ; CustomCommsNamespace namespace = CustomCommsNamespace . newBuilder ( ) . setData ( request . toByteString ( ) ) . setType ( CustomCommsMessageType . SetLayerNameRequest ) . build ( ) ; TerraHarvestPayload payload = createPayload ( namespace ) ; TerraHarvestMessage message = createCustomCommsMessage ( namespace ) ; RemoteChannel channel = mock ( RemoteChannel . class ) ; m_SUT . handleMessage ( message , payload , channel ) ; verify ( m_MessageFactory ) . createBaseErrorMessage ( message , ErrorCode . CCOMM_ERROR , "Unable to set the name for layer PhysicalLink with UUID " + testUuid . toString ( ) + ". Exception:OTHER" ) ; verify ( m_ResponseWrapper ) . queue ( channel ) ; }
Test set name for layers with persistence failed.
Test set name for layers with persistence failed .
//request to set the name of a physical link layer //mock remote channel //handle message //reused channel