mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/utils/push/TestPushChannelsGenericEventHandler.java
@Test
    public void testHandleEvent()
    {
        Event nonRemovedEvent = PowerMockito.mock(Event.class);
        when(nonRemovedEvent.getTopic()).thenReturn("mil/dod/th/ose/gui/webapp/someEvent");
        when(nonRemovedEvent.getPropertyNames()).thenReturn(new String[] {"propKey1", "propKey2"});
        when(nonRemovedEvent.getProperty("propKey1")).thenReturn("propVal1");
        when(nonRemovedEvent.getProperty("propKey2")).thenReturn("propVal2");
        m_SUT.handleEvent(nonRemovedEvent);
        
        ArgumentCaptor<PushDataMessage> msgCaptor = ArgumentCaptor.forClass(PushDataMessage.class);
        verify(m_Manager).addMessage(msgCaptor.capture());
        
        PushDataMessage pushData = msgCaptor.getValue();
        
        PushEventMessage pushMsg = (PushEventMessage)pushData;
        
        assertThat(pushMsg.getType(), is(PushMessageType.EVENT.toString()));
        assertThat(pushMsg.getTopic(), is("mil/dod/th/ose/gui/webapp/someEvent"));
        assertThat(pushMsg.getProperties().size(), is(2));
        assertThat(pushMsg.getProperties().keySet(), hasItems("propKey1", "propKey2"));
        assertThat(pushMsg.getProperties().values(), hasItems((Object)"propVal1", (Object)"propVal2"));
    }
/**
     * Verify that an event is properly pushed and handled 
     */
Verify that an event is properly pushed and handled
Verify that an event is properly pushed and handled
@Test
    public void testHandleEvent()
    {
        Event nonRemovedEvent = PowerMockito.mock(Event.class);
        when(nonRemovedEvent.getTopic()).thenReturn("mil/dod/th/ose/gui/webapp/someEvent");
        when(nonRemovedEvent.getPropertyNames()).thenReturn(new String[] {"propKey1", "propKey2"});
        when(nonRemovedEvent.getProperty("propKey1")).thenReturn("propVal1");
        when(nonRemovedEvent.getProperty("propKey2")).thenReturn("propVal2");
        m_SUT.handleEvent(nonRemovedEvent);
        ArgumentCaptor<PushDataMessage> msgCaptor = ArgumentCaptor.forClass(PushDataMessage.class);
        verify(m_Manager).addMessage(msgCaptor.capture());
        PushDataMessage pushData = msgCaptor.getValue();
        PushEventMessage pushMsg = (PushEventMessage)pushData;
        assertThat(pushMsg.getType(), is(PushMessageType.EVENT.toString()));
        assertThat(pushMsg.getTopic(), is("mil/dod/th/ose/gui/webapp/someEvent"));
        assertThat(pushMsg.getProperties().size(), is(2));
        assertThat(pushMsg.getProperties().keySet(), hasItems("propKey1", "propKey2"));
        assertThat(pushMsg.getProperties().values(), hasItems((Object)"propVal1", (Object)"propVal2"));
    }
@ Test public void testHandleEvent ( ) { Event nonRemovedEvent = PowerMockito . mock ( Event . class ) ; when ( nonRemovedEvent . getTopic ( ) ) . thenReturn ( "mil/dod/th/ose/gui/webapp/someEvent" ) ; when ( nonRemovedEvent . getPropertyNames ( ) ) . thenReturn ( new String [ ] { "propKey1" , "propKey2" } ) ; when ( nonRemovedEvent . getProperty ( "propKey1" ) ) . thenReturn ( "propVal1" ) ; when ( nonRemovedEvent . getProperty ( "propKey2" ) ) . thenReturn ( "propVal2" ) ; m_SUT . handleEvent ( nonRemovedEvent ) ; ArgumentCaptor < PushDataMessage > msgCaptor = ArgumentCaptor . forClass ( PushDataMessage . class ) ; verify ( m_Manager ) . addMessage ( msgCaptor . capture ( ) ) ; PushDataMessage pushData = msgCaptor . getValue ( ) ; PushEventMessage pushMsg = ( PushEventMessage ) pushData ; assertThat ( pushMsg . getType ( ) , is ( PushMessageType . EVENT . toString ( ) ) ) ; assertThat ( pushMsg . getTopic ( ) , is ( "mil/dod/th/ose/gui/webapp/someEvent" ) ) ; assertThat ( pushMsg . getProperties ( ) . size ( ) , is ( 2 ) ) ; assertThat ( pushMsg . getProperties ( ) . keySet ( ) , hasItems ( "propKey1" , "propKey2" ) ) ; assertThat ( pushMsg . getProperties ( ) . values ( ) , hasItems ( ( Object ) "propVal1" , ( Object ) "propVal2" ) ) ; }
Verify that an event is properly pushed and handled
Verify that an event is properly pushed and handled