mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/asset/TestCommandHandlerMgrImpl.java
@Test
    public void testErrorResponseHandler() throws InvalidProtocolBufferException
    {
        //Instantiate response handler.
        ErrorResponseHandler errorHandler = m_SUT.new ErrorResponseHandler();
        
        //String that represents the error message to be displayed by growl.
        String errorStr = "Test Error!";
        
        GenericErrorResponseData dataMessage = GenericErrorResponseData.newBuilder().setError(
                ErrorCode.ASSET_ERROR).setErrorDescription(errorStr).build();
        BaseNamespace namespaceMessage = BaseNamespace.newBuilder().setType(
                BaseMessageType.GenericErrorResponse).setData(dataMessage.toByteString()).build();
        TerraHarvestMessage thMessage = TerraHarvestMessageHelper.createTerraHarvestMessage(CONTROLLER_ID, 0, 
                Namespace.Base, 5000, namespaceMessage);
        TerraHarvestPayload payload = TerraHarvestPayload.parseFrom(thMessage.getTerraHarvestPayload());
        
        //Test generic error response handler.
        errorHandler.handleResponse(thMessage, payload, namespaceMessage, dataMessage);
        
        //Verify that a growl message is displayed and that its contents are correct.
        verify(m_GrowlUtil).createGlobalFacesMessage(FacesMessage.SEVERITY_ERROR, "Could not execute command:", 
                ErrorCode.ASSET_ERROR.toString() + ", " + errorStr);
    }
/**
     * Test the error response handler.
     * Verify the error response is handled appropriately.
     */
Test the error response handler.
Verify the error response is handled appropriately.
Test the error response handler . Verify the error response is handled appropriately .
@Test
    public void testErrorResponseHandler() throws InvalidProtocolBufferException
    {
        ErrorResponseHandler errorHandler = m_SUT.new ErrorResponseHandler();
        String errorStr = "Test Error!";
        GenericErrorResponseData dataMessage = GenericErrorResponseData.newBuilder().setError(
                ErrorCode.ASSET_ERROR).setErrorDescription(errorStr).build();
        BaseNamespace namespaceMessage = BaseNamespace.newBuilder().setType(
                BaseMessageType.GenericErrorResponse).setData(dataMessage.toByteString()).build();
        TerraHarvestMessage thMessage = TerraHarvestMessageHelper.createTerraHarvestMessage(CONTROLLER_ID, 0, 
                Namespace.Base, 5000, namespaceMessage);
        TerraHarvestPayload payload = TerraHarvestPayload.parseFrom(thMessage.getTerraHarvestPayload());
        errorHandler.handleResponse(thMessage, payload, namespaceMessage, dataMessage);
        verify(m_GrowlUtil).createGlobalFacesMessage(FacesMessage.SEVERITY_ERROR, "Could not execute command:", 
                ErrorCode.ASSET_ERROR.toString() + ", " + errorStr);
    }
@ Test public void testErrorResponseHandler ( ) throws InvalidProtocolBufferException { ErrorResponseHandler errorHandler = m_SUT . new ErrorResponseHandler ( ) ; String errorStr = "Test Error!" ; GenericErrorResponseData dataMessage = GenericErrorResponseData . newBuilder ( ) . setError ( ErrorCode . ASSET_ERROR ) . setErrorDescription ( errorStr ) . build ( ) ; BaseNamespace namespaceMessage = BaseNamespace . newBuilder ( ) . setType ( BaseMessageType . GenericErrorResponse ) . setData ( dataMessage . toByteString ( ) ) . build ( ) ; TerraHarvestMessage thMessage = TerraHarvestMessageHelper . createTerraHarvestMessage ( CONTROLLER_ID , 0 , Namespace . Base , 5000 , namespaceMessage ) ; TerraHarvestPayload payload = TerraHarvestPayload . parseFrom ( thMessage . getTerraHarvestPayload ( ) ) ; errorHandler . handleResponse ( thMessage , payload , namespaceMessage , dataMessage ) ; verify ( m_GrowlUtil ) . createGlobalFacesMessage ( FacesMessage . SEVERITY_ERROR , "Could not execute command:" , ErrorCode . ASSET_ERROR . toString ( ) + ", " + errorStr ) ; }
Test the error response handler.
Test the error response handler .
//Instantiate response handler. //String that represents the error message to be displayed by growl. //Test generic error response handler. //Verify that a growl message is displayed and that its contents are correct.