mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/asset/TestCommandHandlerMgrImpl.java
@Test
    public void testSendCommandWithNullType() throws ObjectConverterException
    {
        UUID assetUuid = UUID.randomUUID();
        
        Message testMessage = mock(Message.class);
        ByteString testByteString = ByteString.copyFrom(new byte[1024]);
        
        AzimuthDegrees pan = new AzimuthDegrees().withValue(0.2);
        ElevationDegrees tilt = new ElevationDegrees().withValue(0.2);
        OrientationOffset panTilt = new OrientationOffset(pan, tilt, null);
        SetPanTiltCommand panTiltCmd = new SetPanTiltCommand(null, null, panTilt);
        
        //Mock converter behavior.
        when(m_Converter.convertToProto(Mockito.any(Command.class))).thenReturn(testMessage);
        when(testMessage.toByteString()).thenReturn(testByteString);
        
        try 
        {
            m_SUT.sendCommand(CONTROLLER_ID, assetUuid, panTiltCmd, null);
        }
        catch (IllegalArgumentException exception)
        {
            assertThat(exception.getMessage(), is(String.format("Cannot send %s command to system 0x%08x " 
                    + "because command type is null", panTiltCmd.getClass().getSimpleName(), CONTROLLER_ID)));
        }
        
        //Verify no messages are ever sent.
        verify(m_MessageFactory, never()).createAssetMessage(eq(AssetMessageType.ExecuteCommandRequest), 
                Mockito.any(Message.class));
        verify(m_MessageWrapper, never()).queue(eq(CONTROLLER_ID), Mockito.any(ResponseHandler.class));
    }
/**
     * Test the send command message when the command type is null.
     * Verify that no message is sent since the command type is null.
     */
Test the send command message when the command type is null.
Verify that no message is sent since the command type is null.
Test the send command message when the command type is null . Verify that no message is sent since the command type is null .
@Test
    public void testSendCommandWithNullType() throws ObjectConverterException
    {
        UUID assetUuid = UUID.randomUUID();
        Message testMessage = mock(Message.class);
        ByteString testByteString = ByteString.copyFrom(new byte[1024]);
        AzimuthDegrees pan = new AzimuthDegrees().withValue(0.2);
        ElevationDegrees tilt = new ElevationDegrees().withValue(0.2);
        OrientationOffset panTilt = new OrientationOffset(pan, tilt, null);
        SetPanTiltCommand panTiltCmd = new SetPanTiltCommand(null, null, panTilt);
        when(m_Converter.convertToProto(Mockito.any(Command.class))).thenReturn(testMessage);
        when(testMessage.toByteString()).thenReturn(testByteString);
        try 
        {
            m_SUT.sendCommand(CONTROLLER_ID, assetUuid, panTiltCmd, null);
        }
        catch (IllegalArgumentException exception)
        {
            assertThat(exception.getMessage(), is(String.format("Cannot send %s command to system 0x%08x " 
                    + "because command type is null", panTiltCmd.getClass().getSimpleName(), CONTROLLER_ID)));
        }
        verify(m_MessageFactory, never()).createAssetMessage(eq(AssetMessageType.ExecuteCommandRequest), 
                Mockito.any(Message.class));
        verify(m_MessageWrapper, never()).queue(eq(CONTROLLER_ID), Mockito.any(ResponseHandler.class));
    }
@ Test public void testSendCommandWithNullType ( ) throws ObjectConverterException { UUID assetUuid = UUID . randomUUID ( ) ; Message testMessage = mock ( Message . class ) ; ByteString testByteString = ByteString . copyFrom ( new byte [ 1024 ] ) ; AzimuthDegrees pan = new AzimuthDegrees ( ) . withValue ( 0.2 ) ; ElevationDegrees tilt = new ElevationDegrees ( ) . withValue ( 0.2 ) ; OrientationOffset panTilt = new OrientationOffset ( pan , tilt , null ) ; SetPanTiltCommand panTiltCmd = new SetPanTiltCommand ( null , null , panTilt ) ; when ( m_Converter . convertToProto ( Mockito . any ( Command . class ) ) ) . thenReturn ( testMessage ) ; when ( testMessage . toByteString ( ) ) . thenReturn ( testByteString ) ; try { m_SUT . sendCommand ( CONTROLLER_ID , assetUuid , panTiltCmd , null ) ; } catch ( IllegalArgumentException exception ) { assertThat ( exception . getMessage ( ) , is ( String . format ( "Cannot send %s command to system 0x%08x " + "because command type is null" , panTiltCmd . getClass ( ) . getSimpleName ( ) , CONTROLLER_ID ) ) ) ; } verify ( m_MessageFactory , never ( ) ) . createAssetMessage ( eq ( AssetMessageType . ExecuteCommandRequest ) , Mockito . any ( Message . class ) ) ; verify ( m_MessageWrapper , never ( ) ) . queue ( eq ( CONTROLLER_ID ) , Mockito . any ( ResponseHandler . class ) ) ; }
Test the send command message when the command type is null.
Test the send command message when the command type is null .
//Mock converter behavior. //Verify no messages are ever sent.