mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/ccomm/TestTransportLayerRegistryCallback.java
@Test
    public void testPreObject_WithLinkNotFound() throws FactoryException, ConfigurationException
    {
        String linkName = "name";
        
        when(m_CcommService.findLinkLayer(linkName)).thenReturn(null);
        
        TransportLayerInternal trans = mock(TransportLayerInternal.class);
        TransportLayerAttributes attrs = mock(TransportLayerAttributes.class);
        when(trans.getConfig()).thenReturn(attrs);
        when(attrs.linkLayerName()).thenReturn(linkName);
        
        //act
        try
        {
            m_SUT.preObjectInitialize(trans);
            fail("expected exception due to link layer not being found by comms.");
        }
        catch (FactoryException e)
        {
            //expected
        }
        
        try
        {
            m_SUT.preObjectUpdated(trans);
            fail("expected exception due to link layer not being found by comms.");
        }
        catch (FactoryException e)
        {
            //expected
        }
        
        verify(trans, never()).setLinkLayer(Mockito.any(LinkLayer.class));
    }
/**
     * Verify attempted fetching link layer from comms service in pre processing methods.
     * Verify exception if link is not returned from comms service.
     */
Verify attempted fetching link layer from comms service in pre processing methods.
Verify exception if link is not returned from comms service.
Verify attempted fetching link layer from comms service in pre processing methods . Verify exception if link is not returned from comms service .
@Test
    public void testPreObject_WithLinkNotFound() throws FactoryException, ConfigurationException
    {
        String linkName = "name";
        when(m_CcommService.findLinkLayer(linkName)).thenReturn(null);
        TransportLayerInternal trans = mock(TransportLayerInternal.class);
        TransportLayerAttributes attrs = mock(TransportLayerAttributes.class);
        when(trans.getConfig()).thenReturn(attrs);
        when(attrs.linkLayerName()).thenReturn(linkName);
        try
        {
            m_SUT.preObjectInitialize(trans);
            fail("expected exception due to link layer not being found by comms.");
        }
        catch (FactoryException e)
        {
        }
        try
        {
            m_SUT.preObjectUpdated(trans);
            fail("expected exception due to link layer not being found by comms.");
        }
        catch (FactoryException e)
        {
        }
        verify(trans, never()).setLinkLayer(Mockito.any(LinkLayer.class));
    }
@ Test public void testPreObject_WithLinkNotFound ( ) throws FactoryException , ConfigurationException { String linkName = "name" ; when ( m_CcommService . findLinkLayer ( linkName ) ) . thenReturn ( null ) ; TransportLayerInternal trans = mock ( TransportLayerInternal . class ) ; TransportLayerAttributes attrs = mock ( TransportLayerAttributes . class ) ; when ( trans . getConfig ( ) ) . thenReturn ( attrs ) ; when ( attrs . linkLayerName ( ) ) . thenReturn ( linkName ) ; try { m_SUT . preObjectInitialize ( trans ) ; fail ( "expected exception due to link layer not being found by comms." ) ; } catch ( FactoryException e ) { } try { m_SUT . preObjectUpdated ( trans ) ; fail ( "expected exception due to link layer not being found by comms." ) ; } catch ( FactoryException e ) { } verify ( trans , never ( ) ) . setLinkLayer ( Mockito . any ( LinkLayer . class ) ) ; }
Verify attempted fetching link layer from comms service in pre processing methods.
Verify attempted fetching link layer from comms service in pre processing methods .
//act //expected //expected