mil.dod.th.remote.client/test/mil/dod/th/remote/client/impl/TestEventAdminMessageListener.java
@SuppressWarnings("unchecked")
    @Test
    public void testPostEvent()
    {
        m_SUT.activate();

        // mock
        @SuppressWarnings("rawtypes")
        ArgumentCaptor<MessageListenerCallback> callbackCaptor = ArgumentCaptor.forClass(MessageListenerCallback.class);
        verify(m_MessageListenerService).registerCallback(eq(Namespace.EventAdmin), callbackCaptor.capture());

        @SuppressWarnings("rawtypes")
        MessageListenerCallback callback = callbackCaptor.getValue();
        @SuppressWarnings("rawtypes")
        RemoteMessage remoteMessage = mock(RemoteMessage.class);
        when(remoteMessage.getDataMessageType()).thenReturn(EventAdminMessageType.SendEvent);
        SendEventData sendEventData = SendEventData.newBuilder()
            .setTopic("testEvent1")
            .build();
        when(remoteMessage.getDataMessage()).thenReturn(sendEventData);

        // replay
        callback.handleMessage(remoteMessage);
        
        sendEventData = SendEventData.newBuilder()
                .setTopic("testEvent2")
                .addProperty(ComplexTypesMapEntry.newBuilder()
                    .setKey("testkey")
                    .setProgramStatus(MissionStatus.EXECUTING))
                .build();
        when(remoteMessage.getDataMessage()).thenReturn(sendEventData);

        callback.handleMessage(remoteMessage);

        // verify
        verify(m_EventAdmin, times(2)).postEvent(any(Event.class));
    }
/**
     * Verify that event messages received are posted to EventAdmin.
     */
Verify that event messages received are posted to EventAdmin.
Verify that event messages received are posted to EventAdmin .
@SuppressWarnings("unchecked")
    @Test
    public void testPostEvent()
    {
        m_SUT.activate();
        @SuppressWarnings("rawtypes")
        ArgumentCaptor<MessageListenerCallback> callbackCaptor = ArgumentCaptor.forClass(MessageListenerCallback.class);
        verify(m_MessageListenerService).registerCallback(eq(Namespace.EventAdmin), callbackCaptor.capture());
        @SuppressWarnings("rawtypes")
        MessageListenerCallback callback = callbackCaptor.getValue();
        @SuppressWarnings("rawtypes")
        RemoteMessage remoteMessage = mock(RemoteMessage.class);
        when(remoteMessage.getDataMessageType()).thenReturn(EventAdminMessageType.SendEvent);
        SendEventData sendEventData = SendEventData.newBuilder()
            .setTopic("testEvent1")
            .build();
        when(remoteMessage.getDataMessage()).thenReturn(sendEventData);
        callback.handleMessage(remoteMessage);
        sendEventData = SendEventData.newBuilder()
                .setTopic("testEvent2")
                .addProperty(ComplexTypesMapEntry.newBuilder()
                    .setKey("testkey")
                    .setProgramStatus(MissionStatus.EXECUTING))
                .build();
        when(remoteMessage.getDataMessage()).thenReturn(sendEventData);
        callback.handleMessage(remoteMessage);
        verify(m_EventAdmin, times(2)).postEvent(any(Event.class));
    }
@ SuppressWarnings ( "unchecked" ) @ Test public void testPostEvent ( ) { m_SUT . activate ( ) ; @ SuppressWarnings ( "rawtypes" ) ArgumentCaptor < MessageListenerCallback > callbackCaptor = ArgumentCaptor . forClass ( MessageListenerCallback . class ) ; verify ( m_MessageListenerService ) . registerCallback ( eq ( Namespace . EventAdmin ) , callbackCaptor . capture ( ) ) ; @ SuppressWarnings ( "rawtypes" ) MessageListenerCallback callback = callbackCaptor . getValue ( ) ; @ SuppressWarnings ( "rawtypes" ) RemoteMessage remoteMessage = mock ( RemoteMessage . class ) ; when ( remoteMessage . getDataMessageType ( ) ) . thenReturn ( EventAdminMessageType . SendEvent ) ; SendEventData sendEventData = SendEventData . newBuilder ( ) . setTopic ( "testEvent1" ) . build ( ) ; when ( remoteMessage . getDataMessage ( ) ) . thenReturn ( sendEventData ) ; callback . handleMessage ( remoteMessage ) ; sendEventData = SendEventData . newBuilder ( ) . setTopic ( "testEvent2" ) . addProperty ( ComplexTypesMapEntry . newBuilder ( ) . setKey ( "testkey" ) . setProgramStatus ( MissionStatus . EXECUTING ) ) . build ( ) ; when ( remoteMessage . getDataMessage ( ) ) . thenReturn ( sendEventData ) ; callback . handleMessage ( remoteMessage ) ; verify ( m_EventAdmin , times ( 2 ) ) . postEvent ( any ( Event . class ) ) ; }
Verify that event messages received are posted to EventAdmin.
Verify that event messages received are posted to EventAdmin .
// mock // replay // verify