mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/comms/TestCommsStackRequest.java
@Test
    public void testGetCommsStackForBase()
    {
        List<CommsStackModel> stacks = m_SUT.getCommsStacksAsync(systemId1);
        
        CommsStackModel model = m_SUT.getCommsStackForBaseModel(systemId1, stacks.get(0).getTransport());
        assertThat(model.getTransport(), is(stacks.get(0).getTransport()));
        assertThat(model.getLink(), is(stacks.get(0).getLink()));
        assertThat(model.getPhysical(), is(stacks.get(0).getPhysical()));
        
        model = m_SUT.getCommsStackForBaseModel(systemId1, stacks.get(1).getLink());
        assertThat(model.getTransport(), is(stacks.get(1).getTransport()));
        assertThat(model.getLink(), is(stacks.get(1).getLink()));
        assertThat(model.getPhysical(), is(stacks.get(1).getPhysical()));
        
        model = m_SUT.getCommsStackForBaseModel(systemId1, stacks.get(2).getLink());
        assertThat(model.getTransport(), is(stacks.get(2).getTransport()));
        assertThat(model.getLink(), is(stacks.get(2).getLink()));
        assertThat(model.getPhysical(), is(stacks.get(2).getPhysical()));

        model = m_SUT.getCommsStackForBaseModel(systemId1, stacks.get(3).getPhysical());
        assertThat(model.getTransport(), is(stacks.get(3).getTransport()));
        assertThat(model.getLink(), is(stacks.get(3).getLink()));
        assertThat(model.getPhysical(), is(stacks.get(3).getPhysical()));

        //test null return
        when(m_CommsMgr.getLinksAsync(systemId1)).thenReturn(new ArrayList<CommsLayerLinkModelImpl>());
        when(m_CommsMgr.getTransportsAsync(systemId1)).thenReturn(new ArrayList<CommsLayerBaseModel>());
        when(m_CommsMgr.getPhysicalsAsync(systemId1)).thenReturn(new ArrayList<CommsLayerBaseModel>());
        
        assertThat(m_SUT.getCommsStackForBaseModel(systemId1, stacks.get(0).getTransport()), is(nullValue()));
    }
/**
     * Test return of entire stack based on given layer.
     * Verify correct return of stack containing given layer. 
     */
Test return of entire stack based on given layer.
Verify correct return of stack containing given layer.
Test return of entire stack based on given layer . Verify correct return of stack containing given layer .
@Test
    public void testGetCommsStackForBase()
    {
        List<CommsStackModel> stacks = m_SUT.getCommsStacksAsync(systemId1);
        CommsStackModel model = m_SUT.getCommsStackForBaseModel(systemId1, stacks.get(0).getTransport());
        assertThat(model.getTransport(), is(stacks.get(0).getTransport()));
        assertThat(model.getLink(), is(stacks.get(0).getLink()));
        assertThat(model.getPhysical(), is(stacks.get(0).getPhysical()));
        model = m_SUT.getCommsStackForBaseModel(systemId1, stacks.get(1).getLink());
        assertThat(model.getTransport(), is(stacks.get(1).getTransport()));
        assertThat(model.getLink(), is(stacks.get(1).getLink()));
        assertThat(model.getPhysical(), is(stacks.get(1).getPhysical()));
        model = m_SUT.getCommsStackForBaseModel(systemId1, stacks.get(2).getLink());
        assertThat(model.getTransport(), is(stacks.get(2).getTransport()));
        assertThat(model.getLink(), is(stacks.get(2).getLink()));
        assertThat(model.getPhysical(), is(stacks.get(2).getPhysical()));
        model = m_SUT.getCommsStackForBaseModel(systemId1, stacks.get(3).getPhysical());
        assertThat(model.getTransport(), is(stacks.get(3).getTransport()));
        assertThat(model.getLink(), is(stacks.get(3).getLink()));
        assertThat(model.getPhysical(), is(stacks.get(3).getPhysical()));
        when(m_CommsMgr.getLinksAsync(systemId1)).thenReturn(new ArrayList<CommsLayerLinkModelImpl>());
        when(m_CommsMgr.getTransportsAsync(systemId1)).thenReturn(new ArrayList<CommsLayerBaseModel>());
        when(m_CommsMgr.getPhysicalsAsync(systemId1)).thenReturn(new ArrayList<CommsLayerBaseModel>());
        assertThat(m_SUT.getCommsStackForBaseModel(systemId1, stacks.get(0).getTransport()), is(nullValue()));
    }
@ Test public void testGetCommsStackForBase ( ) { List < CommsStackModel > stacks = m_SUT . getCommsStacksAsync ( systemId1 ) ; CommsStackModel model = m_SUT . getCommsStackForBaseModel ( systemId1 , stacks . get ( 0 ) . getTransport ( ) ) ; assertThat ( model . getTransport ( ) , is ( stacks . get ( 0 ) . getTransport ( ) ) ) ; assertThat ( model . getLink ( ) , is ( stacks . get ( 0 ) . getLink ( ) ) ) ; assertThat ( model . getPhysical ( ) , is ( stacks . get ( 0 ) . getPhysical ( ) ) ) ; model = m_SUT . getCommsStackForBaseModel ( systemId1 , stacks . get ( 1 ) . getLink ( ) ) ; assertThat ( model . getTransport ( ) , is ( stacks . get ( 1 ) . getTransport ( ) ) ) ; assertThat ( model . getLink ( ) , is ( stacks . get ( 1 ) . getLink ( ) ) ) ; assertThat ( model . getPhysical ( ) , is ( stacks . get ( 1 ) . getPhysical ( ) ) ) ; model = m_SUT . getCommsStackForBaseModel ( systemId1 , stacks . get ( 2 ) . getLink ( ) ) ; assertThat ( model . getTransport ( ) , is ( stacks . get ( 2 ) . getTransport ( ) ) ) ; assertThat ( model . getLink ( ) , is ( stacks . get ( 2 ) . getLink ( ) ) ) ; assertThat ( model . getPhysical ( ) , is ( stacks . get ( 2 ) . getPhysical ( ) ) ) ; model = m_SUT . getCommsStackForBaseModel ( systemId1 , stacks . get ( 3 ) . getPhysical ( ) ) ; assertThat ( model . getTransport ( ) , is ( stacks . get ( 3 ) . getTransport ( ) ) ) ; assertThat ( model . getLink ( ) , is ( stacks . get ( 3 ) . getLink ( ) ) ) ; assertThat ( model . getPhysical ( ) , is ( stacks . get ( 3 ) . getPhysical ( ) ) ) ; when ( m_CommsMgr . getLinksAsync ( systemId1 ) ) . thenReturn ( new ArrayList < CommsLayerLinkModelImpl > ( ) ) ; when ( m_CommsMgr . getTransportsAsync ( systemId1 ) ) . thenReturn ( new ArrayList < CommsLayerBaseModel > ( ) ) ; when ( m_CommsMgr . getPhysicalsAsync ( systemId1 ) ) . thenReturn ( new ArrayList < CommsLayerBaseModel > ( ) ) ; assertThat ( m_SUT . getCommsStackForBaseModel ( systemId1 , stacks . get ( 0 ) . getTransport ( ) ) , is ( nullValue ( ) ) ) ; }
Test return of entire stack based on given layer.
Test return of entire stack based on given layer .
//test null return