mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/asset/TestAssetMessageService.java
@Test
    public void testSetAssetNameResponse() throws IOException
    {
        AssetNamespace assetDirMessage = AssetNamespace.newBuilder().
                setType(AssetMessageType.SetNameResponse).build();
        TerraHarvestMessage message = createMessage(assetDirMessage);

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

        //handle message
        m_SUT.handleMessage(message, createPayload(assetDirMessage), channel);
        
        //capture event
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        Event event = eventCaptor.getValue();
        
        //verify
        assertThat((AssetNamespace)event.getProperty(RemoteConstants.EVENT_PROP_NAMESPACE_MESSAGE),
                is(assetDirMessage));
        assertThat((String)event.getProperty(RemoteConstants.EVENT_PROP_MESSAGE_TYPE),
                is(AssetMessageType.SetNameResponse.toString()));
    }
/**
     * Test set name for Asset response.
     * Verify that expected event is posted.
     */
Test set name for Asset response.
Verify that expected event is posted.
Test set name for Asset response . Verify that expected event is posted .
@Test
    public void testSetAssetNameResponse() throws IOException
    {
        AssetNamespace assetDirMessage = AssetNamespace.newBuilder().
                setType(AssetMessageType.SetNameResponse).build();
        TerraHarvestMessage message = createMessage(assetDirMessage);
        RemoteChannel channel = mock(RemoteChannel.class);
        m_SUT.handleMessage(message, createPayload(assetDirMessage), channel);
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        Event event = eventCaptor.getValue();
        assertThat((AssetNamespace)event.getProperty(RemoteConstants.EVENT_PROP_NAMESPACE_MESSAGE),
                is(assetDirMessage));
        assertThat((String)event.getProperty(RemoteConstants.EVENT_PROP_MESSAGE_TYPE),
                is(AssetMessageType.SetNameResponse.toString()));
    }
@ Test public void testSetAssetNameResponse ( ) throws IOException { AssetNamespace assetDirMessage = AssetNamespace . newBuilder ( ) . setType ( AssetMessageType . SetNameResponse ) . build ( ) ; TerraHarvestMessage message = createMessage ( assetDirMessage ) ; RemoteChannel channel = mock ( RemoteChannel . class ) ; m_SUT . handleMessage ( message , createPayload ( assetDirMessage ) , channel ) ; ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin ) . postEvent ( eventCaptor . capture ( ) ) ; Event event = eventCaptor . getValue ( ) ; assertThat ( ( AssetNamespace ) event . getProperty ( RemoteConstants . EVENT_PROP_NAMESPACE_MESSAGE ) , is ( assetDirMessage ) ) ; assertThat ( ( String ) event . getProperty ( RemoteConstants . EVENT_PROP_MESSAGE_TYPE ) , is ( AssetMessageType . SetNameResponse . toString ( ) ) ) ; }
Test set name for Asset response.
Test set name for Asset response .
//mock remote channel //handle message //capture event //verify