mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/ccomm/TestCustomCommsServiceImpl_Physical.java
@Test
    public void testGetPhysicalLinks() throws CCommException, IOException, InterruptedException, FactoryException, 
        FactoryObjectInformationException, IllegalArgumentException, ClassNotFoundException
    {
        //mock
        Set<PhysicalLinkInternal> phySet = new HashSet<>();
        PhysicalLinkInternal phy1 = mock(PhysicalLinkInternal.class);
        PhysicalLinkInternal phy2 = mock(PhysicalLinkInternal.class);
        phySet.add(phy1);
        phySet.add(phy2);
        when(m_PhysRegistry.getObjects()).thenReturn(phySet);

        String name = "name";
        String name2 = "name2";
        
        //act
        m_SUT.createPhysicalLink(PhysicalLinkTypeEnum.SERIAL_PORT, name);
        m_SUT.createPhysicalLink(PhysicalLinkTypeEnum.SERIAL_PORT, name2);

        List<PhysicalLink> phyLinks = m_SUT.getPhysicalLinks();
        
        //verify
        verify(m_PhysRegistry, times(1)).createNewObject(m_PhysFactory, name, new Hashtable<String, Object>());
        verify(m_PhysRegistry, times(1)).createNewObject(m_PhysFactory, name2, new Hashtable<String, Object>());
        assertThat(phyLinks.size(), is(2));
        assertThat(phyLinks, containsInAnyOrder(phy1, phy2));
        verify(m_WakeLock, times(2)).activate();
        verify(m_WakeLock, times(2)).cancel();
    }
/**
     * Verify multiple physical links can be created.
     */
Verify multiple physical links can be created.
Verify multiple physical links can be created .
@Test
    public void testGetPhysicalLinks() throws CCommException, IOException, InterruptedException, FactoryException, 
        FactoryObjectInformationException, IllegalArgumentException, ClassNotFoundException
    {
        Set<PhysicalLinkInternal> phySet = new HashSet<>();
        PhysicalLinkInternal phy1 = mock(PhysicalLinkInternal.class);
        PhysicalLinkInternal phy2 = mock(PhysicalLinkInternal.class);
        phySet.add(phy1);
        phySet.add(phy2);
        when(m_PhysRegistry.getObjects()).thenReturn(phySet);
        String name = "name";
        String name2 = "name2";
        m_SUT.createPhysicalLink(PhysicalLinkTypeEnum.SERIAL_PORT, name);
        m_SUT.createPhysicalLink(PhysicalLinkTypeEnum.SERIAL_PORT, name2);
        List<PhysicalLink> phyLinks = m_SUT.getPhysicalLinks();
        verify(m_PhysRegistry, times(1)).createNewObject(m_PhysFactory, name, new Hashtable<String, Object>());
        verify(m_PhysRegistry, times(1)).createNewObject(m_PhysFactory, name2, new Hashtable<String, Object>());
        assertThat(phyLinks.size(), is(2));
        assertThat(phyLinks, containsInAnyOrder(phy1, phy2));
        verify(m_WakeLock, times(2)).activate();
        verify(m_WakeLock, times(2)).cancel();
    }
@ Test public void testGetPhysicalLinks ( ) throws CCommException , IOException , InterruptedException , FactoryException , FactoryObjectInformationException , IllegalArgumentException , ClassNotFoundException { Set < PhysicalLinkInternal > phySet = new HashSet < > ( ) ; PhysicalLinkInternal phy1 = mock ( PhysicalLinkInternal . class ) ; PhysicalLinkInternal phy2 = mock ( PhysicalLinkInternal . class ) ; phySet . add ( phy1 ) ; phySet . add ( phy2 ) ; when ( m_PhysRegistry . getObjects ( ) ) . thenReturn ( phySet ) ; String name = "name" ; String name2 = "name2" ; m_SUT . createPhysicalLink ( PhysicalLinkTypeEnum . SERIAL_PORT , name ) ; m_SUT . createPhysicalLink ( PhysicalLinkTypeEnum . SERIAL_PORT , name2 ) ; List < PhysicalLink > phyLinks = m_SUT . getPhysicalLinks ( ) ; verify ( m_PhysRegistry , times ( 1 ) ) . createNewObject ( m_PhysFactory , name , new Hashtable < String , Object > ( ) ) ; verify ( m_PhysRegistry , times ( 1 ) ) . createNewObject ( m_PhysFactory , name2 , new Hashtable < String , Object > ( ) ) ; assertThat ( phyLinks . size ( ) , is ( 2 ) ) ; assertThat ( phyLinks , containsInAnyOrder ( phy1 , phy2 ) ) ; verify ( m_WakeLock , times ( 2 ) ) . activate ( ) ; verify ( m_WakeLock , times ( 2 ) ) . cancel ( ) ; }
Verify multiple physical links can be created.
Verify multiple physical links can be created .
//mock //act //verify