mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/mp/TestCurrentMissionMgrImpl.java
@Test
    public void testGetCurrentMissionsForController()
    {
        //verify first time with no controller requests are sent out
        List<CurrentMissionModel> expectedModels = m_SUT.getCurrentMissionsForControllerAsync(123);
        
        assertThat(expectedModels.size(), is(0));
        
        verify(m_MessageFactory).createMissionProgrammingMessage(
                eq(MissionProgrammingMessageType.GetProgramInformationRequest), Mockito.any(Message.class));
        verify(m_MessageWrapper).queue(eq(123), (ResponseHandler) eq(null));
        
        ArgumentCaptor<Message> eventCaptor = ArgumentCaptor.forClass(Message.class);
        
        verify(m_MessageFactory).createEventAdminMessage(eq(EventAdminMessageType.EventRegistrationRequest), 
                eventCaptor.capture());
        verify(m_MessageWrapper, times(2)).queue(eq(123), Mockito.any(ResponseHandler.class));
        
        EventRegistrationRequestData requestData = (EventRegistrationRequestData)eventCaptor.getValue();
        
        assertThat(requestData.getTopicCount(), is(2));
        
        List<String> topics = requestData.getTopicList();
        
        assertThat(topics.contains(Program.TOPIC_PREFIX + "*"), is(true));
        
        assertThat(topics.contains(MissionProgramManager.TOPIC_PREFIX + "*"), is(true));
        
        //call again with same controller
        List<CurrentMissionModel> expectedModels2 = m_SUT.getCurrentMissionsForControllerAsync(123); 
        assertThat(expectedModels2.size(), is(0));
        
        verify(m_MessageFactory, times(1)).createMissionProgrammingMessage(
                eq(MissionProgrammingMessageType.GetProgramInformationRequest), Mockito.any(Message.class));
        verify(m_MessageWrapper).queue(eq(123), (ResponseHandler) eq(null));

        verify(m_MessageFactory, times(1)).createEventAdminMessage(
                eq(EventAdminMessageType.EventRegistrationRequest), 
                Mockito.any(Message.class));
        verify(m_MessageWrapper).queue(eq(123), (ResponseHandler) eq(null));
        
        //initialize m_SUT. Will post a push update
        assertThat(initCurrentMissionModels(123), is(3));
    }
/**
     * Verify proper missions are returned for a controller.
     */
Verify proper missions are returned for a controller.
Verify proper missions are returned for a controller .
@Test
    public void testGetCurrentMissionsForController()
    {
        List<CurrentMissionModel> expectedModels = m_SUT.getCurrentMissionsForControllerAsync(123);
        assertThat(expectedModels.size(), is(0));
        verify(m_MessageFactory).createMissionProgrammingMessage(
                eq(MissionProgrammingMessageType.GetProgramInformationRequest), Mockito.any(Message.class));
        verify(m_MessageWrapper).queue(eq(123), (ResponseHandler) eq(null));
        ArgumentCaptor<Message> eventCaptor = ArgumentCaptor.forClass(Message.class);
        verify(m_MessageFactory).createEventAdminMessage(eq(EventAdminMessageType.EventRegistrationRequest), 
                eventCaptor.capture());
        verify(m_MessageWrapper, times(2)).queue(eq(123), Mockito.any(ResponseHandler.class));
        EventRegistrationRequestData requestData = (EventRegistrationRequestData)eventCaptor.getValue();
        assertThat(requestData.getTopicCount(), is(2));
        List<String> topics = requestData.getTopicList();
        assertThat(topics.contains(Program.TOPIC_PREFIX + "*"), is(true));
        assertThat(topics.contains(MissionProgramManager.TOPIC_PREFIX + "*"), is(true));
        List<CurrentMissionModel> expectedModels2 = m_SUT.getCurrentMissionsForControllerAsync(123); 
        assertThat(expectedModels2.size(), is(0));
        verify(m_MessageFactory, times(1)).createMissionProgrammingMessage(
                eq(MissionProgrammingMessageType.GetProgramInformationRequest), Mockito.any(Message.class));
        verify(m_MessageWrapper).queue(eq(123), (ResponseHandler) eq(null));
        verify(m_MessageFactory, times(1)).createEventAdminMessage(
                eq(EventAdminMessageType.EventRegistrationRequest), 
                Mockito.any(Message.class));
        verify(m_MessageWrapper).queue(eq(123), (ResponseHandler) eq(null));
        assertThat(initCurrentMissionModels(123), is(3));
    }
@ Test public void testGetCurrentMissionsForController ( ) { List < CurrentMissionModel > expectedModels = m_SUT . getCurrentMissionsForControllerAsync ( 123 ) ; assertThat ( expectedModels . size ( ) , is ( 0 ) ) ; verify ( m_MessageFactory ) . createMissionProgrammingMessage ( eq ( MissionProgrammingMessageType . GetProgramInformationRequest ) , Mockito . any ( Message . class ) ) ; verify ( m_MessageWrapper ) . queue ( eq ( 123 ) , ( ResponseHandler ) eq ( null ) ) ; ArgumentCaptor < Message > eventCaptor = ArgumentCaptor . forClass ( Message . class ) ; verify ( m_MessageFactory ) . createEventAdminMessage ( eq ( EventAdminMessageType . EventRegistrationRequest ) , eventCaptor . capture ( ) ) ; verify ( m_MessageWrapper , times ( 2 ) ) . queue ( eq ( 123 ) , Mockito . any ( ResponseHandler . class ) ) ; EventRegistrationRequestData requestData = ( EventRegistrationRequestData ) eventCaptor . getValue ( ) ; assertThat ( requestData . getTopicCount ( ) , is ( 2 ) ) ; List < String > topics = requestData . getTopicList ( ) ; assertThat ( topics . contains ( Program . TOPIC_PREFIX + "*" ) , is ( true ) ) ; assertThat ( topics . contains ( MissionProgramManager . TOPIC_PREFIX + "*" ) , is ( true ) ) ; List < CurrentMissionModel > expectedModels2 = m_SUT . getCurrentMissionsForControllerAsync ( 123 ) ; assertThat ( expectedModels2 . size ( ) , is ( 0 ) ) ; verify ( m_MessageFactory , times ( 1 ) ) . createMissionProgrammingMessage ( eq ( MissionProgrammingMessageType . GetProgramInformationRequest ) , Mockito . any ( Message . class ) ) ; verify ( m_MessageWrapper ) . queue ( eq ( 123 ) , ( ResponseHandler ) eq ( null ) ) ; verify ( m_MessageFactory , times ( 1 ) ) . createEventAdminMessage ( eq ( EventAdminMessageType . EventRegistrationRequest ) , Mockito . any ( Message . class ) ) ; verify ( m_MessageWrapper ) . queue ( eq ( 123 ) , ( ResponseHandler ) eq ( null ) ) ; assertThat ( initCurrentMissionModels ( 123 ) , is ( 3 ) ) ; }
Verify proper missions are returned for a controller.
Verify proper missions are returned for a controller .
//verify first time with no controller requests are sent out //call again with same controller //initialize m_SUT. Will post a push update