mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/ccomm/link/TestLinkLayerImpl.java
@Test
    public void testOnActivateEvent()
    {
        m_SUT.activateLayer();
        
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        //one for activate, last is send
        verify(m_EventAdmin, times(1)).postEvent(eventCaptor.capture());
        verify(m_WakeLock).activate();
        verify(m_WakeLock).cancel();
        
        Event event = EventAdminVerifier.assertEventByTopicOnly(eventCaptor, LinkLayer.TOPIC_ACTIVATED);
        assertThat((LinkLayer)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ), is((LinkLayer)m_SUT));
        assertThat((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_TYPE), 
                is(m_SUT.getFactory().getProductType()));
        assertThat((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_NAME), is(m_Name));
        assertThat((LinkStatus)event.getProperty(LinkLayer.EVENT_PROP_LINK_STATUS), is(LinkStatus.LOST));
        assertThat((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_PID), is(m_Pid));
        assertThat((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_BASE_TYPE), 
                is(m_BaseType));
    }
/**
     * Verify event when layer is activated.
     */
Verify event when layer is activated.
Verify event when layer is activated .
@Test
    public void testOnActivateEvent()
    {
        m_SUT.activateLayer();
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin, times(1)).postEvent(eventCaptor.capture());
        verify(m_WakeLock).activate();
        verify(m_WakeLock).cancel();
        Event event = EventAdminVerifier.assertEventByTopicOnly(eventCaptor, LinkLayer.TOPIC_ACTIVATED);
        assertThat((LinkLayer)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ), is((LinkLayer)m_SUT));
        assertThat((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_TYPE), 
                is(m_SUT.getFactory().getProductType()));
        assertThat((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_NAME), is(m_Name));
        assertThat((LinkStatus)event.getProperty(LinkLayer.EVENT_PROP_LINK_STATUS), is(LinkStatus.LOST));
        assertThat((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_PID), is(m_Pid));
        assertThat((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_BASE_TYPE), 
                is(m_BaseType));
    }
@ Test public void testOnActivateEvent ( ) { m_SUT . activateLayer ( ) ; ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin , times ( 1 ) ) . postEvent ( eventCaptor . capture ( ) ) ; verify ( m_WakeLock ) . activate ( ) ; verify ( m_WakeLock ) . cancel ( ) ; Event event = EventAdminVerifier . assertEventByTopicOnly ( eventCaptor , LinkLayer . TOPIC_ACTIVATED ) ; assertThat ( ( LinkLayer ) event . getProperty ( FactoryDescriptor . EVENT_PROP_OBJ ) , is ( ( LinkLayer ) m_SUT ) ) ; assertThat ( ( String ) event . getProperty ( FactoryDescriptor . EVENT_PROP_OBJ_TYPE ) , is ( m_SUT . getFactory ( ) . getProductType ( ) ) ) ; assertThat ( ( String ) event . getProperty ( FactoryDescriptor . EVENT_PROP_OBJ_NAME ) , is ( m_Name ) ) ; assertThat ( ( LinkStatus ) event . getProperty ( LinkLayer . EVENT_PROP_LINK_STATUS ) , is ( LinkStatus . LOST ) ) ; assertThat ( ( String ) event . getProperty ( FactoryDescriptor . EVENT_PROP_OBJ_PID ) , is ( m_Pid ) ) ; assertThat ( ( String ) event . getProperty ( FactoryDescriptor . EVENT_PROP_OBJ_BASE_TYPE ) , is ( m_BaseType ) ) ; }
Verify event when layer is activated.
Verify event when layer is activated .
//one for activate, last is send