mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/comms/TestCommsLayerBaseModel.java
@Test
    public void testGetImage()
    {
        //test transport layer
        m_SUT = new CommsLayerBaseModel(123, m_Uuid, COMM_PID, "clazzName",
                CommType.TransportLayer, m_FactoryMgr, m_TypesMgr, m_ConfigWrapper, m_CommsImageInterface);   
        
        TransportLayerCapabilities caps = mock(TransportLayerCapabilities.class);
        
        List<LinkLayerTypeEnum> linkEnum = new ArrayList<LinkLayerTypeEnum>();
        linkEnum.add(LinkLayerTypeEnum.CELLULAR);
        when(m_TypesMgr.getCapabilities(123, "clazzName")).thenReturn(caps);
        when(caps.getLinkLayerModalitiesSupported()).thenReturn(linkEnum);
        
        assertThat(m_SUT.getImage(), is(COMMS_ICON_CELLULAR));
        
        //check empty layer enums case
        when(caps.getLinkLayerModalitiesSupported()).thenReturn(new ArrayList<LinkLayerTypeEnum>());        
        assertThat(m_SUT.getImage(), is(COMMS_ICON_GENERIC));
        
        //test null capabilities return
        when(m_TypesMgr.getCapabilities(123, "clazzName")).thenReturn(null);
        assertThat(m_SUT.getImage(), is(COMMS_ICON_GENERIC));
        
        //test physical link
        m_SUT = new CommsLayerBaseModel(0, m_Uuid, COMM_PID, "clazzName",
                CommType.PhysicalLink, m_FactoryMgr, m_TypesMgr, m_ConfigWrapper, m_CommsImageInterface);  
        assertThat(m_SUT.getImage(), is(COMMS_ICON_SERIAL));
        
        //test other
        m_SUT = new CommsLayerBaseModel(0, m_Uuid, COMM_PID, "clazzName", 
                CommType.Linklayer, m_FactoryMgr, m_TypesMgr, m_ConfigWrapper, m_CommsImageInterface);
        assertThat(m_SUT.getImage(), is(COMMS_ICON_GENERIC));
    }
/**
     * Verify correct image path is returned based on capabilities.
     */
Verify correct image path is returned based on capabilities.
Verify correct image path is returned based on capabilities .
@Test
    public void testGetImage()
    {
        m_SUT = new CommsLayerBaseModel(123, m_Uuid, COMM_PID, "clazzName",
                CommType.TransportLayer, m_FactoryMgr, m_TypesMgr, m_ConfigWrapper, m_CommsImageInterface);   
        TransportLayerCapabilities caps = mock(TransportLayerCapabilities.class);
        List<LinkLayerTypeEnum> linkEnum = new ArrayList<LinkLayerTypeEnum>();
        linkEnum.add(LinkLayerTypeEnum.CELLULAR);
        when(m_TypesMgr.getCapabilities(123, "clazzName")).thenReturn(caps);
        when(caps.getLinkLayerModalitiesSupported()).thenReturn(linkEnum);
        assertThat(m_SUT.getImage(), is(COMMS_ICON_CELLULAR));
        when(caps.getLinkLayerModalitiesSupported()).thenReturn(new ArrayList<LinkLayerTypeEnum>());        
        assertThat(m_SUT.getImage(), is(COMMS_ICON_GENERIC));
        when(m_TypesMgr.getCapabilities(123, "clazzName")).thenReturn(null);
        assertThat(m_SUT.getImage(), is(COMMS_ICON_GENERIC));
        m_SUT = new CommsLayerBaseModel(0, m_Uuid, COMM_PID, "clazzName",
                CommType.PhysicalLink, m_FactoryMgr, m_TypesMgr, m_ConfigWrapper, m_CommsImageInterface);  
        assertThat(m_SUT.getImage(), is(COMMS_ICON_SERIAL));
        m_SUT = new CommsLayerBaseModel(0, m_Uuid, COMM_PID, "clazzName", 
                CommType.Linklayer, m_FactoryMgr, m_TypesMgr, m_ConfigWrapper, m_CommsImageInterface);
        assertThat(m_SUT.getImage(), is(COMMS_ICON_GENERIC));
    }
@ Test public void testGetImage ( ) { m_SUT = new CommsLayerBaseModel ( 123 , m_Uuid , COMM_PID , "clazzName" , CommType . TransportLayer , m_FactoryMgr , m_TypesMgr , m_ConfigWrapper , m_CommsImageInterface ) ; TransportLayerCapabilities caps = mock ( TransportLayerCapabilities . class ) ; List < LinkLayerTypeEnum > linkEnum = new ArrayList < LinkLayerTypeEnum > ( ) ; linkEnum . add ( LinkLayerTypeEnum . CELLULAR ) ; when ( m_TypesMgr . getCapabilities ( 123 , "clazzName" ) ) . thenReturn ( caps ) ; when ( caps . getLinkLayerModalitiesSupported ( ) ) . thenReturn ( linkEnum ) ; assertThat ( m_SUT . getImage ( ) , is ( COMMS_ICON_CELLULAR ) ) ; when ( caps . getLinkLayerModalitiesSupported ( ) ) . thenReturn ( new ArrayList < LinkLayerTypeEnum > ( ) ) ; assertThat ( m_SUT . getImage ( ) , is ( COMMS_ICON_GENERIC ) ) ; when ( m_TypesMgr . getCapabilities ( 123 , "clazzName" ) ) . thenReturn ( null ) ; assertThat ( m_SUT . getImage ( ) , is ( COMMS_ICON_GENERIC ) ) ; m_SUT = new CommsLayerBaseModel ( 0 , m_Uuid , COMM_PID , "clazzName" , CommType . PhysicalLink , m_FactoryMgr , m_TypesMgr , m_ConfigWrapper , m_CommsImageInterface ) ; assertThat ( m_SUT . getImage ( ) , is ( COMMS_ICON_SERIAL ) ) ; m_SUT = new CommsLayerBaseModel ( 0 , m_Uuid , COMM_PID , "clazzName" , CommType . Linklayer , m_FactoryMgr , m_TypesMgr , m_ConfigWrapper , m_CommsImageInterface ) ; assertThat ( m_SUT . getImage ( ) , is ( COMMS_ICON_GENERIC ) ) ; }
Verify correct image path is returned based on capabilities.
Verify correct image path is returned based on capabilities .
//test transport layer //check empty layer enums case //test null capabilities return //test physical link //test other