mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/mp/TestMissionProgrammingMessageService.java
@Test
    public void testUnregisterHandlers() throws IllegalArgumentException, IOException
    {
        //request
        MissionProgrammingNamespace missionMessage = MissionProgrammingNamespace.newBuilder().
                setType(MissionProgrammingMessageType.UnregisterEventHandlerRequest).build();
        TerraHarvestMessage message = createMissionProgrammingMessage(missionMessage);
        
        RemoteChannel channel = mock(RemoteChannel.class);
        
        m_SUT.handleMessage(message, createPayload(missionMessage), channel);
        
        //verify interaction
        verify(m_EventHandlerHelper).unregisterAllHandlers();
        
        // verify the event
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        Event event = eventCaptor.getValue();
        assertThat((String)event.getProperty(RemoteConstants.EVENT_PROP_MESSAGE_TYPE),
                is(MissionProgrammingMessageType.UnregisterEventHandlerRequest.toString()));
        
        //verify response
        verify(m_MessageFactory).createMissionProgrammingResponseMessage(message, 
                MissionProgrammingMessageType.UnregisterEventHandlerResponse, null);
        verify(m_ResponseWrapper).queue(channel);
    }
/**
     * Test requesting event handler helper to unregister all handlers.
     * Verify response and the interaction with that service.
     */
Test requesting event handler helper to unregister all handlers.
Verify response and the interaction with that service.
Test requesting event handler helper to unregister all handlers . Verify response and the interaction with that service .
@Test
    public void testUnregisterHandlers() throws IllegalArgumentException, IOException
    {
        MissionProgrammingNamespace missionMessage = MissionProgrammingNamespace.newBuilder().
                setType(MissionProgrammingMessageType.UnregisterEventHandlerRequest).build();
        TerraHarvestMessage message = createMissionProgrammingMessage(missionMessage);
        RemoteChannel channel = mock(RemoteChannel.class);
        m_SUT.handleMessage(message, createPayload(missionMessage), channel);
        verify(m_EventHandlerHelper).unregisterAllHandlers();
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        Event event = eventCaptor.getValue();
        assertThat((String)event.getProperty(RemoteConstants.EVENT_PROP_MESSAGE_TYPE),
                is(MissionProgrammingMessageType.UnregisterEventHandlerRequest.toString()));
        verify(m_MessageFactory).createMissionProgrammingResponseMessage(message, 
                MissionProgrammingMessageType.UnregisterEventHandlerResponse, null);
        verify(m_ResponseWrapper).queue(channel);
    }
@ Test public void testUnregisterHandlers ( ) throws IllegalArgumentException , IOException { MissionProgrammingNamespace missionMessage = MissionProgrammingNamespace . newBuilder ( ) . setType ( MissionProgrammingMessageType . UnregisterEventHandlerRequest ) . build ( ) ; TerraHarvestMessage message = createMissionProgrammingMessage ( missionMessage ) ; RemoteChannel channel = mock ( RemoteChannel . class ) ; m_SUT . handleMessage ( message , createPayload ( missionMessage ) , channel ) ; verify ( m_EventHandlerHelper ) . unregisterAllHandlers ( ) ; ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin ) . postEvent ( eventCaptor . capture ( ) ) ; Event event = eventCaptor . getValue ( ) ; assertThat ( ( String ) event . getProperty ( RemoteConstants . EVENT_PROP_MESSAGE_TYPE ) , is ( MissionProgrammingMessageType . UnregisterEventHandlerRequest . toString ( ) ) ) ; verify ( m_MessageFactory ) . createMissionProgrammingResponseMessage ( message , MissionProgrammingMessageType . UnregisterEventHandlerResponse , null ) ; verify ( m_ResponseWrapper ) . queue ( channel ) ; }
Test requesting event handler helper to unregister all handlers.
Test requesting event handler helper to unregister all handlers .
//request //verify interaction // verify the event //verify response