mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/ccomm/TestCustomCommsServiceImpl_LinkLayer.java
@Test
    public void testGetLinkLayers() 
        throws CCommException, IOException, InterruptedException, IllegalArgumentException, 
            IllegalStateException, FactoryException, FactoryObjectInformationException 
    {
        String link1Name = "name";
        when(m_LinkInternal.getName()).thenReturn(link1Name);
        
        //mock another link layer
        String link2Name = "namers";
        LinkLayerInternal intLink = mock(LinkLayerInternal.class);
        when(intLink.getName()).thenReturn(link2Name);
        
        //reg will return this list
        Set<LinkLayerInternal> links = new HashSet<>();
        links.add(intLink);
        links.add(m_LinkInternal);
        when(m_LinkRegistry.getObjects()).thenReturn(links);
        
        List<LinkLayer> list = m_SUT.getLinkLayers();
        
        assertThat(list.size(), is(2));

        List<String> checkLayerNames = new ArrayList<String>();
        
        for (LinkLayer layer : list)
        {
            checkLayerNames.add(layer.getName());
        }
        assertThat(checkLayerNames, hasItems(link1Name, link2Name));
    }
/**
     * Verifies get link layers correctly retrieves all link layers.
     */
Verifies get link layers correctly retrieves all link layers.
Verifies get link layers correctly retrieves all link layers .
@Test
    public void testGetLinkLayers() 
        throws CCommException, IOException, InterruptedException, IllegalArgumentException, 
            IllegalStateException, FactoryException, FactoryObjectInformationException 
    {
        String link1Name = "name";
        when(m_LinkInternal.getName()).thenReturn(link1Name);
        String link2Name = "namers";
        LinkLayerInternal intLink = mock(LinkLayerInternal.class);
        when(intLink.getName()).thenReturn(link2Name);
        Set<LinkLayerInternal> links = new HashSet<>();
        links.add(intLink);
        links.add(m_LinkInternal);
        when(m_LinkRegistry.getObjects()).thenReturn(links);
        List<LinkLayer> list = m_SUT.getLinkLayers();
        assertThat(list.size(), is(2));
        List<String> checkLayerNames = new ArrayList<String>();
        for (LinkLayer layer : list)
        {
            checkLayerNames.add(layer.getName());
        }
        assertThat(checkLayerNames, hasItems(link1Name, link2Name));
    }
@ Test public void testGetLinkLayers ( ) throws CCommException , IOException , InterruptedException , IllegalArgumentException , IllegalStateException , FactoryException , FactoryObjectInformationException { String link1Name = "name" ; when ( m_LinkInternal . getName ( ) ) . thenReturn ( link1Name ) ; String link2Name = "namers" ; LinkLayerInternal intLink = mock ( LinkLayerInternal . class ) ; when ( intLink . getName ( ) ) . thenReturn ( link2Name ) ; Set < LinkLayerInternal > links = new HashSet < > ( ) ; links . add ( intLink ) ; links . add ( m_LinkInternal ) ; when ( m_LinkRegistry . getObjects ( ) ) . thenReturn ( links ) ; List < LinkLayer > list = m_SUT . getLinkLayers ( ) ; assertThat ( list . size ( ) , is ( 2 ) ) ; List < String > checkLayerNames = new ArrayList < String > ( ) ; for ( LinkLayer layer : list ) { checkLayerNames . add ( layer . getName ( ) ) ; } assertThat ( checkLayerNames , hasItems ( link1Name , link2Name ) ) ; }
Verifies get link layers correctly retrieves all link layers.
Verifies get link layers correctly retrieves all link layers .
//mock another link layer //reg will return this list