mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/mp/TestMissionLoadSelected.java
@Test
    public void testLocalLoadMissionUnableConvertTemplateToProto() throws ObjectConverterException
    {
        //mock schedule
        MissionProgramSchedule schedule = getSchedule();
        MissionModel model = getModelA();       
        //mock mission manager behavior
        when(m_MissionManager.getMission()).thenReturn(model);
        when(m_MissionManager.getSchedule()).thenReturn(schedule);
        
        //mock controller
        ControllerModel controller = mock(ControllerModel.class);
        when(controller.getId()).thenReturn(123);
        //mock active controller
        when(m_ActiveController.isActiveControllerSet()).thenReturn(true);
        when(m_ActiveController.getActiveController()).thenReturn(controller);
        
        //template representing the model
        MissionProgramTemplate template = getTemplate();
        //mock template program manager behavior
        when(m_TemplateManager.getTemplate(model.getName())).thenReturn(template);
        
        //mock converter throwing exception
        when(m_Converter.convertToProto(Mockito.any())).thenThrow(new ObjectConverterException(""));
        
        //try to load mock mission, capture string returned
        try
        {
            m_SUT.loadMission();
            fail("Expecting exception");
        }
        catch (ObjectConverterException exception)
        {
            //expecting exception
        }
        //verify message sender never sent
        verify(m_MissionProgMgr, never()).queueMessage(eq(123), Mockito.any(Message.class), 
                Mockito.any(MissionProgrammingMessageType.class));
    }
/**
     * Test loading a local mission template that can't be converted to a proto message.
     * 
     * Verify message sender NEVER sends template.
     * 
     * Verify message sender NEVER sends parameters.
     */
Test loading a local mission template that can't be converted to a proto message.

Verify message sender NEVER sends template.

Verify message sender NEVER sends parameters.
Test loading a local mission template that can ' t be converted to a proto message . Verify message sender NEVER sends template . Verify message sender NEVER sends parameters .
@Test
    public void testLocalLoadMissionUnableConvertTemplateToProto() throws ObjectConverterException
    {
        MissionProgramSchedule schedule = getSchedule();
        MissionModel model = getModelA();       
        when(m_MissionManager.getMission()).thenReturn(model);
        when(m_MissionManager.getSchedule()).thenReturn(schedule);
        ControllerModel controller = mock(ControllerModel.class);
        when(controller.getId()).thenReturn(123);
        when(m_ActiveController.isActiveControllerSet()).thenReturn(true);
        when(m_ActiveController.getActiveController()).thenReturn(controller);
        MissionProgramTemplate template = getTemplate();
        when(m_TemplateManager.getTemplate(model.getName())).thenReturn(template);
        when(m_Converter.convertToProto(Mockito.any())).thenThrow(new ObjectConverterException(""));
        try
        {
            m_SUT.loadMission();
            fail("Expecting exception");
        }
        catch (ObjectConverterException exception)
        {
        }
        verify(m_MissionProgMgr, never()).queueMessage(eq(123), Mockito.any(Message.class), 
                Mockito.any(MissionProgrammingMessageType.class));
    }
@ Test public void testLocalLoadMissionUnableConvertTemplateToProto ( ) throws ObjectConverterException { MissionProgramSchedule schedule = getSchedule ( ) ; MissionModel model = getModelA ( ) ; when ( m_MissionManager . getMission ( ) ) . thenReturn ( model ) ; when ( m_MissionManager . getSchedule ( ) ) . thenReturn ( schedule ) ; ControllerModel controller = mock ( ControllerModel . class ) ; when ( controller . getId ( ) ) . thenReturn ( 123 ) ; when ( m_ActiveController . isActiveControllerSet ( ) ) . thenReturn ( true ) ; when ( m_ActiveController . getActiveController ( ) ) . thenReturn ( controller ) ; MissionProgramTemplate template = getTemplate ( ) ; when ( m_TemplateManager . getTemplate ( model . getName ( ) ) ) . thenReturn ( template ) ; when ( m_Converter . convertToProto ( Mockito . any ( ) ) ) . thenThrow ( new ObjectConverterException ( "" ) ) ; try { m_SUT . loadMission ( ) ; fail ( "Expecting exception" ) ; } catch ( ObjectConverterException exception ) { } verify ( m_MissionProgMgr , never ( ) ) . queueMessage ( eq ( 123 ) , Mockito . any ( Message . class ) , Mockito . any ( MissionProgrammingMessageType . class ) ) ; }
Test loading a local mission template that can't be converted to a proto message.
Test loading a local mission template that can ' t be converted to a proto message .
//mock schedule //mock mission manager behavior //mock controller //mock active controller //template representing the model //mock template program manager behavior //mock converter throwing exception //try to load mock mission, capture string returned //expecting exception //verify message sender never sent