mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/ccomm/physical/TestPhysicalLinkImpl.java
@Test
    public void testRelease_NotInUse()
    {
        //mocking
        LinkLayer linkLayer = mock(LinkLayer.class);
        when(m_PhysLinkProxy.isOpen()).thenReturn(false);
        
        //act
        m_SUT.setInUse(false);
        m_SUT.setOwner(linkLayer);
        
        try
        {
            m_SUT.release();
            fail("Should not be able to release as not in use");
        }
        catch (IllegalStateException e) { }
        
        assertThat(m_SUT.isInUse(), is(false));
        assertThat(m_SUT.getOwner(), is(linkLayer));
    }
/**
     * Verify the a physical link cannot be released if not in use.
     */
Verify the a physical link cannot be released if not in use.
Verify the a physical link cannot be released if not in use .
@Test
    public void testRelease_NotInUse()
    {
        LinkLayer linkLayer = mock(LinkLayer.class);
        when(m_PhysLinkProxy.isOpen()).thenReturn(false);
        m_SUT.setInUse(false);
        m_SUT.setOwner(linkLayer);
        try
        {
            m_SUT.release();
            fail("Should not be able to release as not in use");
        }
        catch (IllegalStateException e) { }
        assertThat(m_SUT.isInUse(), is(false));
        assertThat(m_SUT.getOwner(), is(linkLayer));
    }
@ Test public void testRelease_NotInUse ( ) { LinkLayer linkLayer = mock ( LinkLayer . class ) ; when ( m_PhysLinkProxy . isOpen ( ) ) . thenReturn ( false ) ; m_SUT . setInUse ( false ) ; m_SUT . setOwner ( linkLayer ) ; try { m_SUT . release ( ) ; fail ( "Should not be able to release as not in use" ) ; } catch ( IllegalStateException e ) { } assertThat ( m_SUT . isInUse ( ) , is ( false ) ) ; assertThat ( m_SUT . getOwner ( ) , is ( linkLayer ) ) ; }
Verify the a physical link cannot be released if not in use.
Verify the a physical link cannot be released if not in use .
//mocking //act