mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/asset/TestSelectedAssetImpl.java
@Test
    public void testRequestNameUpdate()
    {
        //create mock asset model
        AssetModel model = mock(AssetModel.class);
        when(model.getControllerId()).thenReturn(systemId);
        when(model.getWorkingName()).thenReturn("AssetMcAsset");
        when(model.getUuid()).thenReturn(uuid);
        
        m_SUT.requestNameUpdate(model);
        
        //verify message sent to config admin
        ArgumentCaptor<SetNameRequestData> request = 
            ArgumentCaptor.forClass(SetNameRequestData.class);

        verify(m_MessageFactory).createAssetMessage(
            eq(AssetMessageType.SetNameRequest), request.capture());
        verify(m_MessageWrapper).queue(eq(systemId), (ResponseHandler) eq(null));

        //get message
        SetNameRequestData requestCapture = request.getValue();
        
        //verify
        assertThat(requestCapture.getAssetName(), is("AssetMcAsset"));
        assertThat(requestCapture.getUuid(), is(SharedMessageUtils.convertUUIDToProtoUUID(uuid)));
        
        //Verify that the selected asset is returned to null after the request.
        assertThat(m_SUT.getSelectedAssetForDialog(), is(nullValue()));
    }
/**
     * Test the request for an asset's name to be set/updated.
     * Verify message sent.
     */
Test the request for an asset's name to be set/updated.
Verify message sent.
Test the request for an asset ' s name to be set / updated . Verify message sent .
@Test
    public void testRequestNameUpdate()
    {
        AssetModel model = mock(AssetModel.class);
        when(model.getControllerId()).thenReturn(systemId);
        when(model.getWorkingName()).thenReturn("AssetMcAsset");
        when(model.getUuid()).thenReturn(uuid);
        m_SUT.requestNameUpdate(model);
        ArgumentCaptor<SetNameRequestData> request = 
            ArgumentCaptor.forClass(SetNameRequestData.class);
        verify(m_MessageFactory).createAssetMessage(
            eq(AssetMessageType.SetNameRequest), request.capture());
        verify(m_MessageWrapper).queue(eq(systemId), (ResponseHandler) eq(null));
        SetNameRequestData requestCapture = request.getValue();
        assertThat(requestCapture.getAssetName(), is("AssetMcAsset"));
        assertThat(requestCapture.getUuid(), is(SharedMessageUtils.convertUUIDToProtoUUID(uuid)));
        assertThat(m_SUT.getSelectedAssetForDialog(), is(nullValue()));
    }
@ Test public void testRequestNameUpdate ( ) { AssetModel model = mock ( AssetModel . class ) ; when ( model . getControllerId ( ) ) . thenReturn ( systemId ) ; when ( model . getWorkingName ( ) ) . thenReturn ( "AssetMcAsset" ) ; when ( model . getUuid ( ) ) . thenReturn ( uuid ) ; m_SUT . requestNameUpdate ( model ) ; ArgumentCaptor < SetNameRequestData > request = ArgumentCaptor . forClass ( SetNameRequestData . class ) ; verify ( m_MessageFactory ) . createAssetMessage ( eq ( AssetMessageType . SetNameRequest ) , request . capture ( ) ) ; verify ( m_MessageWrapper ) . queue ( eq ( systemId ) , ( ResponseHandler ) eq ( null ) ) ; SetNameRequestData requestCapture = request . getValue ( ) ; assertThat ( requestCapture . getAssetName ( ) , is ( "AssetMcAsset" ) ) ; assertThat ( requestCapture . getUuid ( ) , is ( SharedMessageUtils . convertUUIDToProtoUUID ( uuid ) ) ) ; assertThat ( m_SUT . getSelectedAssetForDialog ( ) , is ( nullValue ( ) ) ) ; }
Test the request for an asset's name to be set/updated.
Test the request for an asset ' s name to be set / updated .
//create mock asset model //verify message sent to config admin //get message //verify //Verify that the selected asset is returned to null after the request.