mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/mp/TestCurrentMissionMgrImpl.java
@Test
    public void testMissionErrorHandler()
    {
        m_SUT.executeShutdownRequest("Hawks", 123);
        
        ArgumentCaptor<MissionErrorHandler> handleCaptor = ArgumentCaptor.forClass(MissionErrorHandler.class);
        verify(m_MessageFactory).createMissionProgrammingMessage(
                eq(MissionProgrammingMessageType.ExecuteShutdownRequest),
                Mockito.any(Message.class));
        verify(m_MessageWrapper).queue(eq(123), handleCaptor.capture());
        
        assertThat(handleCaptor.getValue(), notNullValue());
        
        MissionErrorHandler handler = handleCaptor.getValue();
        
        GenericErrorResponseData data = GenericErrorResponseData.newBuilder().
                setError(ErrorCode.INTERNAL_ERROR).setErrorDescription("O man more errors").build();
        
        BaseNamespace nameResponse = BaseNamespace.newBuilder().
                setData(data.toByteString()).
                setType(BaseMessageType.GenericErrorResponse).build();
        
        TerraHarvestPayload payload = TerraHarvestPayload.newBuilder().setNamespace(Namespace.Base).
                setNamespaceMessage(data.toByteString()).build();    
        
        TerraHarvestMessage message = TerraHarvestMessageHelper.
                createTerraHarvestMessage(123, 0, Namespace.Base, 1, data);
        
        handler.handleResponse(message, payload, nameResponse, data);
        
        ArgumentCaptor<String> errMsgCaptor = ArgumentCaptor.forClass(String.class);
        verify(m_GrowlUtil).createGlobalFacesMessage(eq(FacesMessage.SEVERITY_ERROR), 
                eq("Mission Error Occurred"), errMsgCaptor.capture());
        
        
        assertThat(errMsgCaptor.getValue().contains("O man more errors"), is(true));
        assertThat(errMsgCaptor.getValue().contains(ErrorCode.INTERNAL_ERROR.toString()), is(true));
    }
/**
     * Verify mission error handler properly handles error messages.
     */
Verify mission error handler properly handles error messages.
Verify mission error handler properly handles error messages .
@Test
    public void testMissionErrorHandler()
    {
        m_SUT.executeShutdownRequest("Hawks", 123);
        ArgumentCaptor<MissionErrorHandler> handleCaptor = ArgumentCaptor.forClass(MissionErrorHandler.class);
        verify(m_MessageFactory).createMissionProgrammingMessage(
                eq(MissionProgrammingMessageType.ExecuteShutdownRequest),
                Mockito.any(Message.class));
        verify(m_MessageWrapper).queue(eq(123), handleCaptor.capture());
        assertThat(handleCaptor.getValue(), notNullValue());
        MissionErrorHandler handler = handleCaptor.getValue();
        GenericErrorResponseData data = GenericErrorResponseData.newBuilder().
                setError(ErrorCode.INTERNAL_ERROR).setErrorDescription("O man more errors").build();
        BaseNamespace nameResponse = BaseNamespace.newBuilder().
                setData(data.toByteString()).
                setType(BaseMessageType.GenericErrorResponse).build();
        TerraHarvestPayload payload = TerraHarvestPayload.newBuilder().setNamespace(Namespace.Base).
                setNamespaceMessage(data.toByteString()).build();    
        TerraHarvestMessage message = TerraHarvestMessageHelper.
                createTerraHarvestMessage(123, 0, Namespace.Base, 1, data);
        handler.handleResponse(message, payload, nameResponse, data);
        ArgumentCaptor<String> errMsgCaptor = ArgumentCaptor.forClass(String.class);
        verify(m_GrowlUtil).createGlobalFacesMessage(eq(FacesMessage.SEVERITY_ERROR), 
                eq("Mission Error Occurred"), errMsgCaptor.capture());
        assertThat(errMsgCaptor.getValue().contains("O man more errors"), is(true));
        assertThat(errMsgCaptor.getValue().contains(ErrorCode.INTERNAL_ERROR.toString()), is(true));
    }
@ Test public void testMissionErrorHandler ( ) { m_SUT . executeShutdownRequest ( "Hawks" , 123 ) ; ArgumentCaptor < MissionErrorHandler > handleCaptor = ArgumentCaptor . forClass ( MissionErrorHandler . class ) ; verify ( m_MessageFactory ) . createMissionProgrammingMessage ( eq ( MissionProgrammingMessageType . ExecuteShutdownRequest ) , Mockito . any ( Message . class ) ) ; verify ( m_MessageWrapper ) . queue ( eq ( 123 ) , handleCaptor . capture ( ) ) ; assertThat ( handleCaptor . getValue ( ) , notNullValue ( ) ) ; MissionErrorHandler handler = handleCaptor . getValue ( ) ; GenericErrorResponseData data = GenericErrorResponseData . newBuilder ( ) . setError ( ErrorCode . INTERNAL_ERROR ) . setErrorDescription ( "O man more errors" ) . build ( ) ; BaseNamespace nameResponse = BaseNamespace . newBuilder ( ) . setData ( data . toByteString ( ) ) . setType ( BaseMessageType . GenericErrorResponse ) . build ( ) ; TerraHarvestPayload payload = TerraHarvestPayload . newBuilder ( ) . setNamespace ( Namespace . Base ) . setNamespaceMessage ( data . toByteString ( ) ) . build ( ) ; TerraHarvestMessage message = TerraHarvestMessageHelper . createTerraHarvestMessage ( 123 , 0 , Namespace . Base , 1 , data ) ; handler . handleResponse ( message , payload , nameResponse , data ) ; ArgumentCaptor < String > errMsgCaptor = ArgumentCaptor . forClass ( String . class ) ; verify ( m_GrowlUtil ) . createGlobalFacesMessage ( eq ( FacesMessage . SEVERITY_ERROR ) , eq ( "Mission Error Occurred" ) , errMsgCaptor . capture ( ) ) ; assertThat ( errMsgCaptor . getValue ( ) . contains ( "O man more errors" ) , is ( true ) ) ; assertThat ( errMsgCaptor . getValue ( ) . contains ( ErrorCode . INTERNAL_ERROR . toString ( ) ) , is ( true ) ) ; }
Verify mission error handler properly handles error messages.
Verify mission error handler properly handles error messages .