mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/comms/TestCommsLayerTypesMgrImpl.java
@Test
    public void testCapabilitiesHandlerException() throws ObjectConverterException
    {
        CapabilitiesResponseHandler handler1 = m_SUT.new CapabilitiesResponseHandler("class.name.one");

        BaseCapabilities transBaseCaps = BaseCapabilities.newBuilder()
                .setDescription("fancy description")
                .setProductName("fancyName")
                .build();
        TransportLayerCapabilitiesGen.TransportLayerCapabilities caps1 = 
                TransportLayerCapabilitiesGen.TransportLayerCapabilities.newBuilder()
                .setBase(transBaseCaps)
                .build();
        
        //response message to process
        GetCapabilitiesResponseData response1 = GetCapabilitiesResponseData.newBuilder().
                setCommType(CommType.TransportLayer).setProductType("class.name.one").
                setTransportCapabilities(caps1).build();

        CustomCommsNamespace nameResponse1 = CustomCommsNamespace.newBuilder().
            setData(response1.toByteString()).
            setType(CustomCommsMessageType.GetCapabilitiesResponse).build();

        TerraHarvestPayload payload1 = TerraHarvestPayload.newBuilder().setNamespace(Namespace.CustomComms).
            setNamespaceMessage(response1.toByteString()).build();  
            
        TerraHarvestMessage thMessage1 = TerraHarvestMessageHelper.createTerraHarvestMessage(systemId1, 0,
            Namespace.CustomComms, 123, nameResponse1);
        
        when(m_Converter.convertToJaxb(Mockito.any(Message.class))).thenThrow(new ObjectConverterException(""));
        
        handler1.handleResponse(thMessage1, payload1, nameResponse1, response1);
        
        verify(m_GrowlUtil).createGlobalFacesMessage(eq(FacesMessage.SEVERITY_ERROR), 
                eq("Object Conversion Exception"),
                eq(String.format("An error occurred trying to retrieve capabilities for comm type [class.name.one]")), 
                Mockito.any(ObjectConverterException.class));
    }
/**
     * Verify exception is thrown if a capabilities objects cannot be converted from protobuf to JAXB.
     */
Verify exception is thrown if a capabilities objects cannot be converted from protobuf to JAXB.
Verify exception is thrown if a capabilities objects cannot be converted from protobuf to JAXB .
@Test
    public void testCapabilitiesHandlerException() throws ObjectConverterException
    {
        CapabilitiesResponseHandler handler1 = m_SUT.new CapabilitiesResponseHandler("class.name.one");
        BaseCapabilities transBaseCaps = BaseCapabilities.newBuilder()
                .setDescription("fancy description")
                .setProductName("fancyName")
                .build();
        TransportLayerCapabilitiesGen.TransportLayerCapabilities caps1 = 
                TransportLayerCapabilitiesGen.TransportLayerCapabilities.newBuilder()
                .setBase(transBaseCaps)
                .build();
        GetCapabilitiesResponseData response1 = GetCapabilitiesResponseData.newBuilder().
                setCommType(CommType.TransportLayer).setProductType("class.name.one").
                setTransportCapabilities(caps1).build();
        CustomCommsNamespace nameResponse1 = CustomCommsNamespace.newBuilder().
            setData(response1.toByteString()).
            setType(CustomCommsMessageType.GetCapabilitiesResponse).build();
        TerraHarvestPayload payload1 = TerraHarvestPayload.newBuilder().setNamespace(Namespace.CustomComms).
            setNamespaceMessage(response1.toByteString()).build();  
        TerraHarvestMessage thMessage1 = TerraHarvestMessageHelper.createTerraHarvestMessage(systemId1, 0,
            Namespace.CustomComms, 123, nameResponse1);
        when(m_Converter.convertToJaxb(Mockito.any(Message.class))).thenThrow(new ObjectConverterException(""));
        handler1.handleResponse(thMessage1, payload1, nameResponse1, response1);
        verify(m_GrowlUtil).createGlobalFacesMessage(eq(FacesMessage.SEVERITY_ERROR), 
                eq("Object Conversion Exception"),
                eq(String.format("An error occurred trying to retrieve capabilities for comm type [class.name.one]")), 
                Mockito.any(ObjectConverterException.class));
    }
@ Test public void testCapabilitiesHandlerException ( ) throws ObjectConverterException { CapabilitiesResponseHandler handler1 = m_SUT . new CapabilitiesResponseHandler ( "class.name.one" ) ; BaseCapabilities transBaseCaps = BaseCapabilities . newBuilder ( ) . setDescription ( "fancy description" ) . setProductName ( "fancyName" ) . build ( ) ; TransportLayerCapabilitiesGen . TransportLayerCapabilities caps1 = TransportLayerCapabilitiesGen . TransportLayerCapabilities . newBuilder ( ) . setBase ( transBaseCaps ) . build ( ) ; GetCapabilitiesResponseData response1 = GetCapabilitiesResponseData . newBuilder ( ) . setCommType ( CommType . TransportLayer ) . setProductType ( "class.name.one" ) . setTransportCapabilities ( caps1 ) . build ( ) ; CustomCommsNamespace nameResponse1 = CustomCommsNamespace . newBuilder ( ) . setData ( response1 . toByteString ( ) ) . setType ( CustomCommsMessageType . GetCapabilitiesResponse ) . build ( ) ; TerraHarvestPayload payload1 = TerraHarvestPayload . newBuilder ( ) . setNamespace ( Namespace . CustomComms ) . setNamespaceMessage ( response1 . toByteString ( ) ) . build ( ) ; TerraHarvestMessage thMessage1 = TerraHarvestMessageHelper . createTerraHarvestMessage ( systemId1 , 0 , Namespace . CustomComms , 123 , nameResponse1 ) ; when ( m_Converter . convertToJaxb ( Mockito . any ( Message . class ) ) ) . thenThrow ( new ObjectConverterException ( "" ) ) ; handler1 . handleResponse ( thMessage1 , payload1 , nameResponse1 , response1 ) ; verify ( m_GrowlUtil ) . createGlobalFacesMessage ( eq ( FacesMessage . SEVERITY_ERROR ) , eq ( "Object Conversion Exception" ) , eq ( String . format ( "An error occurred trying to retrieve capabilities for comm type [class.name.one]" ) ) , Mockito . any ( ObjectConverterException . class ) ) ; }
Verify exception is thrown if a capabilities objects cannot be converted from protobuf to JAXB.
Verify exception is thrown if a capabilities objects cannot be converted from protobuf to JAXB .
//response message to process