mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/asset/TestAssetMgrImpl.java
@Test
    public void testLocationUpdate() throws InvalidProtocolBufferException
    {
        AssetModel assetModel = mock(AssetModel.class);
        when(assetModel.getName()).thenReturn("annie");
        when(assetModel.getUuid()).thenReturn(uuid1);
        LocationModel location = new LocationModel();
        when(assetModel.getLocation()).thenReturn(location);
        location.setLongitude(1.00000001);
        location.setLatitude(2.00000002);
        location.setAltitude(3.00000003);
        location.setBank(4.04);
        location.setElevation(5.05);
        location.setHeading(6.06);
        
        m_SUT.locationUpdate(0, assetModel);
        
        ArgumentCaptor<ExecuteCommandRequestData> requestDataCapture = ArgumentCaptor.
                forClass(ExecuteCommandRequestData.class);
        
        verify(m_MessageFactory).createAssetMessage(eq(AssetMessageType.ExecuteCommandRequest), 
                requestDataCapture.capture());
        verify(m_MessageWrapper).queue(eq(0), Mockito.any(AssetExecuteErrorHandler.class));
        
        ExecuteCommandRequestData request = requestDataCapture.getValue();
        
        assertThat(request.getCommandType(), is(CommandTypesGen.CommandType.Enum.SET_POSITION_COMMAND));
        
        SetPositionCommand setPositionCommand = SetPositionCommand.parseFrom(request.getCommand());
        Coordinates testLocation = setPositionCommand.getLocation();
        Orientation testOrientation = setPositionCommand.getOrientation();
        
        assertThat(testLocation.getLongitude().getValue(), is(location.getLongitude()));
        assertThat(testLocation.getLatitude().getValue(), is(location.getLatitude()));
        assertThat(testLocation.getAltitude().getValue(), is(location.getAltitude()));
        
        assertThat(testOrientation.getBank().getValue(), is(location.getBank()));
        assertThat(testOrientation.getElevation().getValue(), is(location.getElevation()));
        assertThat(testOrientation.getHeading().getValue(), is(location.getHeading()));
    }
/**
     * Verify the asset mgr location update sends the correct requests to update the location with
     * values in the asset model.
     */
Verify the asset mgr location update sends the correct requests to update the location with
values in the asset model.
Verify the asset mgr location update sends the correct requests to update the location with values in the asset model .
@Test
    public void testLocationUpdate() throws InvalidProtocolBufferException
    {
        AssetModel assetModel = mock(AssetModel.class);
        when(assetModel.getName()).thenReturn("annie");
        when(assetModel.getUuid()).thenReturn(uuid1);
        LocationModel location = new LocationModel();
        when(assetModel.getLocation()).thenReturn(location);
        location.setLongitude(1.00000001);
        location.setLatitude(2.00000002);
        location.setAltitude(3.00000003);
        location.setBank(4.04);
        location.setElevation(5.05);
        location.setHeading(6.06);
        m_SUT.locationUpdate(0, assetModel);
        ArgumentCaptor<ExecuteCommandRequestData> requestDataCapture = ArgumentCaptor.
                forClass(ExecuteCommandRequestData.class);
        verify(m_MessageFactory).createAssetMessage(eq(AssetMessageType.ExecuteCommandRequest), 
                requestDataCapture.capture());
        verify(m_MessageWrapper).queue(eq(0), Mockito.any(AssetExecuteErrorHandler.class));
        ExecuteCommandRequestData request = requestDataCapture.getValue();
        assertThat(request.getCommandType(), is(CommandTypesGen.CommandType.Enum.SET_POSITION_COMMAND));
        SetPositionCommand setPositionCommand = SetPositionCommand.parseFrom(request.getCommand());
        Coordinates testLocation = setPositionCommand.getLocation();
        Orientation testOrientation = setPositionCommand.getOrientation();
        assertThat(testLocation.getLongitude().getValue(), is(location.getLongitude()));
        assertThat(testLocation.getLatitude().getValue(), is(location.getLatitude()));
        assertThat(testLocation.getAltitude().getValue(), is(location.getAltitude()));
        assertThat(testOrientation.getBank().getValue(), is(location.getBank()));
        assertThat(testOrientation.getElevation().getValue(), is(location.getElevation()));
        assertThat(testOrientation.getHeading().getValue(), is(location.getHeading()));
    }
@ Test public void testLocationUpdate ( ) throws InvalidProtocolBufferException { AssetModel assetModel = mock ( AssetModel . class ) ; when ( assetModel . getName ( ) ) . thenReturn ( "annie" ) ; when ( assetModel . getUuid ( ) ) . thenReturn ( uuid1 ) ; LocationModel location = new LocationModel ( ) ; when ( assetModel . getLocation ( ) ) . thenReturn ( location ) ; location . setLongitude ( 1.00000001 ) ; location . setLatitude ( 2.00000002 ) ; location . setAltitude ( 3.00000003 ) ; location . setBank ( 4.04 ) ; location . setElevation ( 5.05 ) ; location . setHeading ( 6.06 ) ; m_SUT . locationUpdate ( 0 , assetModel ) ; ArgumentCaptor < ExecuteCommandRequestData > requestDataCapture = ArgumentCaptor . forClass ( ExecuteCommandRequestData . class ) ; verify ( m_MessageFactory ) . createAssetMessage ( eq ( AssetMessageType . ExecuteCommandRequest ) , requestDataCapture . capture ( ) ) ; verify ( m_MessageWrapper ) . queue ( eq ( 0 ) , Mockito . any ( AssetExecuteErrorHandler . class ) ) ; ExecuteCommandRequestData request = requestDataCapture . getValue ( ) ; assertThat ( request . getCommandType ( ) , is ( CommandTypesGen . CommandType . Enum . SET_POSITION_COMMAND ) ) ; SetPositionCommand setPositionCommand = SetPositionCommand . parseFrom ( request . getCommand ( ) ) ; Coordinates testLocation = setPositionCommand . getLocation ( ) ; Orientation testOrientation = setPositionCommand . getOrientation ( ) ; assertThat ( testLocation . getLongitude ( ) . getValue ( ) , is ( location . getLongitude ( ) ) ) ; assertThat ( testLocation . getLatitude ( ) . getValue ( ) , is ( location . getLatitude ( ) ) ) ; assertThat ( testLocation . getAltitude ( ) . getValue ( ) , is ( location . getAltitude ( ) ) ) ; assertThat ( testOrientation . getBank ( ) . getValue ( ) , is ( location . getBank ( ) ) ) ; assertThat ( testOrientation . getElevation ( ) . getValue ( ) , is ( location . getElevation ( ) ) ) ; assertThat ( testOrientation . getHeading ( ) . getValue ( ) , is ( location . getHeading ( ) ) ) ; }
Verify the asset mgr location update sends the correct requests to update the location with
 values in the asset model.
Verify the asset mgr location update sends the correct requests to update the location with values in the asset model .