mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/asset/TestAssetMessageService.java
@Test
    public void testSetAssetNameRequestIllegal() throws IOException, IllegalArgumentException
    {
        when(m_AssetDirectoryService.getAssetByUuid(testUuid)).thenThrow(new IllegalArgumentException("Exception"));
        
        SetNameRequestData request = SetNameRequestData.newBuilder().
                setAssetName("name").
                setUuid(SharedMessageUtils.convertUUIDToProtoUUID(testUuid)).build();
        AssetNamespace assetDirMessage = AssetNamespace.newBuilder().
                setType(AssetMessageType.SetNameRequest).
                setData(request.toByteString()).build();
        TerraHarvestMessage message = createMessage(assetDirMessage);

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

        //handle message
        m_SUT.handleMessage(message, createPayload(assetDirMessage), channel);

        verify(m_MessageFactory).createBaseErrorMessage(message, ErrorCode.INVALID_VALUE, 
                "Request to set the asset's name with UUID " + testUuid.toString()
                + " was null, overlapped with another asset's name, or the asset was not found. Exception");
        verify(m_ResponseWrapper).queue(channel);
    }
/**
     * Test set name for Asset request where the asset isn't known.
     * Verify that the expected error message is sent.
     */
Test set name for Asset request where the asset isn't known.
Verify that the expected error message is sent.
Test set name for Asset request where the asset isn ' t known . Verify that the expected error message is sent .
@Test
    public void testSetAssetNameRequestIllegal() throws IOException, IllegalArgumentException
    {
        when(m_AssetDirectoryService.getAssetByUuid(testUuid)).thenThrow(new IllegalArgumentException("Exception"));
        SetNameRequestData request = SetNameRequestData.newBuilder().
                setAssetName("name").
                setUuid(SharedMessageUtils.convertUUIDToProtoUUID(testUuid)).build();
        AssetNamespace assetDirMessage = AssetNamespace.newBuilder().
                setType(AssetMessageType.SetNameRequest).
                setData(request.toByteString()).build();
        TerraHarvestMessage message = createMessage(assetDirMessage);
        RemoteChannel channel = mock(RemoteChannel.class);
        m_SUT.handleMessage(message, createPayload(assetDirMessage), channel);
        verify(m_MessageFactory).createBaseErrorMessage(message, ErrorCode.INVALID_VALUE, 
                "Request to set the asset's name with UUID " + testUuid.toString()
                + " was null, overlapped with another asset's name, or the asset was not found. Exception");
        verify(m_ResponseWrapper).queue(channel);
    }
@ Test public void testSetAssetNameRequestIllegal ( ) throws IOException , IllegalArgumentException { when ( m_AssetDirectoryService . getAssetByUuid ( testUuid ) ) . thenThrow ( new IllegalArgumentException ( "Exception" ) ) ; SetNameRequestData request = SetNameRequestData . newBuilder ( ) . setAssetName ( "name" ) . setUuid ( SharedMessageUtils . convertUUIDToProtoUUID ( testUuid ) ) . build ( ) ; AssetNamespace assetDirMessage = AssetNamespace . newBuilder ( ) . setType ( AssetMessageType . SetNameRequest ) . setData ( request . toByteString ( ) ) . build ( ) ; TerraHarvestMessage message = createMessage ( assetDirMessage ) ; RemoteChannel channel = mock ( RemoteChannel . class ) ; m_SUT . handleMessage ( message , createPayload ( assetDirMessage ) , channel ) ; verify ( m_MessageFactory ) . createBaseErrorMessage ( message , ErrorCode . INVALID_VALUE , "Request to set the asset's name with UUID " + testUuid . toString ( ) + " was null, overlapped with another asset's name, or the asset was not found. Exception" ) ; verify ( m_ResponseWrapper ) . queue ( channel ) ; }
Test set name for Asset request where the asset isn't known.
Test set name for Asset request where the asset isn ' t known .
//mock remote channel //handle message