mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/ccomm/TestCustomCommsServiceImpl_LinkLayer.java
@Test
    public void testCreateLinkLayerException() 
        throws IOException, InterruptedException, CCommException, FactoryException, IllegalArgumentException, 
            FactoryObjectInformationException, ClassNotFoundException
    {
        String name = "name";
        
        when(m_PhysInternal.getName()).thenReturn(name);
        PhysicalLink physicalLink = m_SUT.createPhysicalLink(PhysicalLinkTypeEnum.SERIAL_PORT);

        when(m_LinkRegistry.createNewObject(
            eq(m_LinkFactory), Mockito.anyString(), Mockito.any(Map.class))).
                thenThrow(new FactoryException("exception"));
        try
        {
            m_SUT.createLinkLayer(LL_PRODUCT_TYPE, physicalLink.getName());
            fail("Expected due to mocking.");
        }
        catch (CCommException e)
        {
            //expected
        }

        verify(m_WakeLock, times(2)).activate();
        verify(m_WakeLock, times(2)).cancel();
    }
/**
     * Verify that if another link layer tries to use the same physical link already in use, the creation fails.
     */
Verify that if another link layer tries to use the same physical link already in use, the creation fails.
Verify that if another link layer tries to use the same physical link already in use the creation fails .
@Test
    public void testCreateLinkLayerException() 
        throws IOException, InterruptedException, CCommException, FactoryException, IllegalArgumentException, 
            FactoryObjectInformationException, ClassNotFoundException
    {
        String name = "name";
        when(m_PhysInternal.getName()).thenReturn(name);
        PhysicalLink physicalLink = m_SUT.createPhysicalLink(PhysicalLinkTypeEnum.SERIAL_PORT);
        when(m_LinkRegistry.createNewObject(
            eq(m_LinkFactory), Mockito.anyString(), Mockito.any(Map.class))).
                thenThrow(new FactoryException("exception"));
        try
        {
            m_SUT.createLinkLayer(LL_PRODUCT_TYPE, physicalLink.getName());
            fail("Expected due to mocking.");
        }
        catch (CCommException e)
        {
        }
        verify(m_WakeLock, times(2)).activate();
        verify(m_WakeLock, times(2)).cancel();
    }
@ Test public void testCreateLinkLayerException ( ) throws IOException , InterruptedException , CCommException , FactoryException , IllegalArgumentException , FactoryObjectInformationException , ClassNotFoundException { String name = "name" ; when ( m_PhysInternal . getName ( ) ) . thenReturn ( name ) ; PhysicalLink physicalLink = m_SUT . createPhysicalLink ( PhysicalLinkTypeEnum . SERIAL_PORT ) ; when ( m_LinkRegistry . createNewObject ( eq ( m_LinkFactory ) , Mockito . anyString ( ) , Mockito . any ( Map . class ) ) ) . thenThrow ( new FactoryException ( "exception" ) ) ; try { m_SUT . createLinkLayer ( LL_PRODUCT_TYPE , physicalLink . getName ( ) ) ; fail ( "Expected due to mocking." ) ; } catch ( CCommException e ) { } verify ( m_WakeLock , times ( 2 ) ) . activate ( ) ; verify ( m_WakeLock , times ( 2 ) ) . cancel ( ) ; }
Verify that if another link layer tries to use the same physical link already in use, the creation fails.
Verify that if another link layer tries to use the same physical link already in use the creation fails .
//expected