mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/asset/TestCommandHandlerMgrImpl.java
@Test
    public void testErrorResponseHandlerNotBaseNamespace() throws InvalidProtocolBufferException
    {
        //Instantiate response handler.
        ErrorResponseHandler errorHandler = m_SUT.new ErrorResponseHandler();
        BaseCapabilities baseCapabilities = BaseCapabilities.newBuilder().setDescription("Blah")
                .setProductName("Some Product").build();
        AssetCapabilities assetCapabilities = AssetCapabilities.newBuilder().setBase(baseCapabilities).build();
        GetCapabilitiesResponseData dataMessage = GetCapabilitiesResponseData.newBuilder()
                .setCapabilities(assetCapabilities).setProductType("Some Product").build();
        AssetDirectoryServiceNamespace namespaceMessage = AssetDirectoryServiceNamespace.newBuilder()
                .setType(AssetDirectoryServiceMessageType.GetCapabilitiesResponse)
                .setData(dataMessage.toByteString()).build();
        
        TerraHarvestMessage thMessage = TerraHarvestMessageHelper.createTerraHarvestMessage(CONTROLLER_ID, 0, 
                Namespace.Asset, 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, never()).createGlobalFacesMessage(eq(FacesMessage.SEVERITY_ERROR), 
                eq("Could not execute command:"), Mockito.anyString());
    }
/**
     * Verify that error response handler doesn't do anything if not a base namespace message.
     */
Verify that error response handler doesn't do anything if not a base namespace message.
Verify that error response handler doesn ' t do anything if not a base namespace message .
@Test
    public void testErrorResponseHandlerNotBaseNamespace() throws InvalidProtocolBufferException
    {
        ErrorResponseHandler errorHandler = m_SUT.new ErrorResponseHandler();
        BaseCapabilities baseCapabilities = BaseCapabilities.newBuilder().setDescription("Blah")
                .setProductName("Some Product").build();
        AssetCapabilities assetCapabilities = AssetCapabilities.newBuilder().setBase(baseCapabilities).build();
        GetCapabilitiesResponseData dataMessage = GetCapabilitiesResponseData.newBuilder()
                .setCapabilities(assetCapabilities).setProductType("Some Product").build();
        AssetDirectoryServiceNamespace namespaceMessage = AssetDirectoryServiceNamespace.newBuilder()
                .setType(AssetDirectoryServiceMessageType.GetCapabilitiesResponse)
                .setData(dataMessage.toByteString()).build();
        TerraHarvestMessage thMessage = TerraHarvestMessageHelper.createTerraHarvestMessage(CONTROLLER_ID, 0, 
                Namespace.Asset, 5000, namespaceMessage);
        TerraHarvestPayload payload = TerraHarvestPayload.parseFrom(thMessage.getTerraHarvestPayload());
        errorHandler.handleResponse(thMessage, payload, namespaceMessage, dataMessage);
        verify(m_GrowlUtil, never()).createGlobalFacesMessage(eq(FacesMessage.SEVERITY_ERROR), 
                eq("Could not execute command:"), Mockito.anyString());
    }
@ Test public void testErrorResponseHandlerNotBaseNamespace ( ) throws InvalidProtocolBufferException { ErrorResponseHandler errorHandler = m_SUT . new ErrorResponseHandler ( ) ; BaseCapabilities baseCapabilities = BaseCapabilities . newBuilder ( ) . setDescription ( "Blah" ) . setProductName ( "Some Product" ) . build ( ) ; AssetCapabilities assetCapabilities = AssetCapabilities . newBuilder ( ) . setBase ( baseCapabilities ) . build ( ) ; GetCapabilitiesResponseData dataMessage = GetCapabilitiesResponseData . newBuilder ( ) . setCapabilities ( assetCapabilities ) . setProductType ( "Some Product" ) . build ( ) ; AssetDirectoryServiceNamespace namespaceMessage = AssetDirectoryServiceNamespace . newBuilder ( ) . setType ( AssetDirectoryServiceMessageType . GetCapabilitiesResponse ) . setData ( dataMessage . toByteString ( ) ) . build ( ) ; TerraHarvestMessage thMessage = TerraHarvestMessageHelper . createTerraHarvestMessage ( CONTROLLER_ID , 0 , Namespace . Asset , 5000 , namespaceMessage ) ; TerraHarvestPayload payload = TerraHarvestPayload . parseFrom ( thMessage . getTerraHarvestPayload ( ) ) ; errorHandler . handleResponse ( thMessage , payload , namespaceMessage , dataMessage ) ; verify ( m_GrowlUtil , never ( ) ) . createGlobalFacesMessage ( eq ( FacesMessage . SEVERITY_ERROR ) , eq ( "Could not execute command:" ) , Mockito . anyString ( ) ) ; }
Verify that error response handler doesn't do anything if not a base namespace message.
Verify that error response handler doesn ' t do anything if not a base namespace message .
//Instantiate response handler. //Test generic error response handler. //Verify that a growl message is displayed and that its contents are correct.