mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/ccomm/TestTransportLayerRegistryCallback.java
@Test
    public void testPreObject_WithLink() throws FactoryException, ConfigurationException
    {
        String linkName = "name";
        
        LinkLayer link = mock(LinkLayer.class);
        when(m_CcommService.findLinkLayer(linkName)).thenReturn(link);
        
        TransportLayerInternal trans = mock(TransportLayerInternal.class);
        TransportLayerAttributes attrs = mock(TransportLayerAttributes.class);
        when(trans.getConfig()).thenReturn(attrs);
        when(attrs.linkLayerName()).thenReturn(linkName);
        
        //act
        m_SUT.preObjectInitialize(trans);
        
        verify(trans).setLinkLayer(link);
        
        // update call should do the same
        m_SUT.preObjectUpdated(trans);
        
        verify(trans, times(2)).setLinkLayer(link);
    }
/**
     * Verify fetching link layer from comms service in pre processing methods.
     */
Verify fetching link layer from comms service in pre processing methods.
Verify fetching link layer from comms service in pre processing methods .
@Test
    public void testPreObject_WithLink() throws FactoryException, ConfigurationException
    {
        String linkName = "name";
        LinkLayer link = mock(LinkLayer.class);
        when(m_CcommService.findLinkLayer(linkName)).thenReturn(link);
        TransportLayerInternal trans = mock(TransportLayerInternal.class);
        TransportLayerAttributes attrs = mock(TransportLayerAttributes.class);
        when(trans.getConfig()).thenReturn(attrs);
        when(attrs.linkLayerName()).thenReturn(linkName);
        m_SUT.preObjectInitialize(trans);
        verify(trans).setLinkLayer(link);
        m_SUT.preObjectUpdated(trans);
        verify(trans, times(2)).setLinkLayer(link);
    }
@ Test public void testPreObject_WithLink ( ) throws FactoryException , ConfigurationException { String linkName = "name" ; LinkLayer link = mock ( LinkLayer . class ) ; when ( m_CcommService . findLinkLayer ( linkName ) ) . thenReturn ( link ) ; TransportLayerInternal trans = mock ( TransportLayerInternal . class ) ; TransportLayerAttributes attrs = mock ( TransportLayerAttributes . class ) ; when ( trans . getConfig ( ) ) . thenReturn ( attrs ) ; when ( attrs . linkLayerName ( ) ) . thenReturn ( linkName ) ; m_SUT . preObjectInitialize ( trans ) ; verify ( trans ) . setLinkLayer ( link ) ; m_SUT . preObjectUpdated ( trans ) ; verify ( trans , times ( 2 ) ) . setLinkLayer ( link ) ; }
Verify fetching link layer from comms service in pre processing methods.
Verify fetching link layer from comms service in pre processing methods .
//act // update call should do the same