mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/ccomm/link/TestLinkLayerImpl.java
@Test
    public void testPostEvent() throws CCommException, IOException, IllegalArgumentException, IllegalStateException, 
        FactoryException, ConfigurationException, AssetException
    {
        m_SUT.internalSetName("test-link-layer");

        Map<String, Object> props = new HashMap<String, Object>();
        props.put("prop1", 2);
        props.put("prop2", "test");
        m_SUT.postEvent("blah", props);
        
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin, times(1)).postEvent(eventCaptor.capture());
        
        Event event = EventAdminVerifier.assertEventByTopicOnly(eventCaptor, "blah");
        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("test-link-layer"));
        assertThat((LinkStatus)event.getProperty(LinkLayer.EVENT_PROP_LINK_STATUS), is(LinkStatus.LOST));
        assertThat((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_PID), is(m_SUT.getPid()));
        assertThat((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_BASE_TYPE), 
                is(m_BaseType));
    }
/**
     * Test that the link layer can post an event and all necessary properties are present.
     */
Test that the link layer can post an event and all necessary properties are present.
Test that the link layer can post an event and all necessary properties are present .
@Test
    public void testPostEvent() throws CCommException, IOException, IllegalArgumentException, IllegalStateException, 
        FactoryException, ConfigurationException, AssetException
    {
        m_SUT.internalSetName("test-link-layer");
        Map<String, Object> props = new HashMap<String, Object>();
        props.put("prop1", 2);
        props.put("prop2", "test");
        m_SUT.postEvent("blah", props);
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin, times(1)).postEvent(eventCaptor.capture());
        Event event = EventAdminVerifier.assertEventByTopicOnly(eventCaptor, "blah");
        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("test-link-layer"));
        assertThat((LinkStatus)event.getProperty(LinkLayer.EVENT_PROP_LINK_STATUS), is(LinkStatus.LOST));
        assertThat((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_PID), is(m_SUT.getPid()));
        assertThat((String)event.getProperty(FactoryDescriptor.EVENT_PROP_OBJ_BASE_TYPE), 
                is(m_BaseType));
    }
@ Test public void testPostEvent ( ) throws CCommException , IOException , IllegalArgumentException , IllegalStateException , FactoryException , ConfigurationException , AssetException { m_SUT . internalSetName ( "test-link-layer" ) ; Map < String , Object > props = new HashMap < String , Object > ( ) ; props . put ( "prop1" , 2 ) ; props . put ( "prop2" , "test" ) ; m_SUT . postEvent ( "blah" , props ) ; ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin , times ( 1 ) ) . postEvent ( eventCaptor . capture ( ) ) ; Event event = EventAdminVerifier . assertEventByTopicOnly ( eventCaptor , "blah" ) ; 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 ( "test-link-layer" ) ) ; assertThat ( ( LinkStatus ) event . getProperty ( LinkLayer . EVENT_PROP_LINK_STATUS ) , is ( LinkStatus . LOST ) ) ; assertThat ( ( String ) event . getProperty ( FactoryDescriptor . EVENT_PROP_OBJ_PID ) , is ( m_SUT . getPid ( ) ) ) ; assertThat ( ( String ) event . getProperty ( FactoryDescriptor . EVENT_PROP_OBJ_BASE_TYPE ) , is ( m_BaseType ) ) ; }
Test that the link layer can post an event and all necessary properties are present.
Test that the link layer can post an event and all necessary properties are present .