mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/mp/TestMissionProgramMgrImpl.java
@Test
    public void testGetTemplatesResponse() throws ObjectConverterException
    {
        //mock controller
        ControllerModel model = mock(ControllerModel.class);
        when(model.getId()).thenReturn(911);
        
        //active controller behavior
        when(m_ActiveController.isActiveControllerSet()).thenReturn(true);
        when(m_ActiveController.getActiveController()).thenReturn(model);

        Event event = mockGetTemplatesRequestMutiples(911);

        //behavior for converter
        MissionProgramTemplate template1 = mock(MissionProgramTemplate.class);
        when(template1.getName()).thenReturn("I am a name");
        MissionProgramTemplate template2 = mock(MissionProgramTemplate.class);
        when(template2.getName()).thenReturn("I am a name too");
        MissionProgramTemplate template3 = mock(MissionProgramTemplate.class);
        when(template3.getName()).thenReturn("I am a name three");
        when(m_Converter.convertToJaxb(Mockito.any(Message.class))).thenReturn(template1, template2, template3);

        m_ListenerMission.handleEvent(event);

        //verify that the templates were added
        assertThat(m_SUT.getRemoteTemplateNames(911).size(), is(3));
    }
/**
     * Test handling of GetTemplates response.
     * 
     */
Test handling of GetTemplates response.
Test handling of GetTemplates response .
@Test
    public void testGetTemplatesResponse() throws ObjectConverterException
    {
        ControllerModel model = mock(ControllerModel.class);
        when(model.getId()).thenReturn(911);
        when(m_ActiveController.isActiveControllerSet()).thenReturn(true);
        when(m_ActiveController.getActiveController()).thenReturn(model);
        Event event = mockGetTemplatesRequestMutiples(911);
        MissionProgramTemplate template1 = mock(MissionProgramTemplate.class);
        when(template1.getName()).thenReturn("I am a name");
        MissionProgramTemplate template2 = mock(MissionProgramTemplate.class);
        when(template2.getName()).thenReturn("I am a name too");
        MissionProgramTemplate template3 = mock(MissionProgramTemplate.class);
        when(template3.getName()).thenReturn("I am a name three");
        when(m_Converter.convertToJaxb(Mockito.any(Message.class))).thenReturn(template1, template2, template3);
        m_ListenerMission.handleEvent(event);
        assertThat(m_SUT.getRemoteTemplateNames(911).size(), is(3));
    }
@ Test public void testGetTemplatesResponse ( ) throws ObjectConverterException { ControllerModel model = mock ( ControllerModel . class ) ; when ( model . getId ( ) ) . thenReturn ( 911 ) ; when ( m_ActiveController . isActiveControllerSet ( ) ) . thenReturn ( true ) ; when ( m_ActiveController . getActiveController ( ) ) . thenReturn ( model ) ; Event event = mockGetTemplatesRequestMutiples ( 911 ) ; MissionProgramTemplate template1 = mock ( MissionProgramTemplate . class ) ; when ( template1 . getName ( ) ) . thenReturn ( "I am a name" ) ; MissionProgramTemplate template2 = mock ( MissionProgramTemplate . class ) ; when ( template2 . getName ( ) ) . thenReturn ( "I am a name too" ) ; MissionProgramTemplate template3 = mock ( MissionProgramTemplate . class ) ; when ( template3 . getName ( ) ) . thenReturn ( "I am a name three" ) ; when ( m_Converter . convertToJaxb ( Mockito . any ( Message . class ) ) ) . thenReturn ( template1 , template2 , template3 ) ; m_ListenerMission . handleEvent ( event ) ; assertThat ( m_SUT . getRemoteTemplateNames ( 911 ) . size ( ) , is ( 3 ) ) ; }
Test handling of GetTemplates response.
Test handling of GetTemplates response .
//mock controller //active controller behavior //behavior for converter //verify that the templates were added