mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/mp/TestCurrentMissionRequestImpl.java
@Test
    public void testGetCurrentFilteredMissions()
    {
        //test that empty list is returned when no missions exist
        assertThat(m_SUT.getCurrentFilteredMissions(123).size(), is(0));
        
        CurrentMissionModel model1 = new CurrentMissionModel("Mission 1", 
                ProgramStatus.CANCELED, "Template 1", (long)0, (long)0);
        CurrentMissionModel model2 = new CurrentMissionModel("Mission 2", 
                ProgramStatus.EXECUTED, "Template 2", (long)0, (long)0);
        CurrentMissionModel model3 = new CurrentMissionModel("Mission 3", 
                ProgramStatus.EXECUTING, "Template 3", (long)0, (long)0);
        CurrentMissionModel model4 = new CurrentMissionModel("Mission 4", 
                ProgramStatus.EXECUTING_TEST, "Template 4", (long)0, (long)0);
        CurrentMissionModel model5 = new CurrentMissionModel("Mission 5", 
                ProgramStatus.INITIALIZATION_ERROR, "Template 5", (long)0, (long)0);
        CurrentMissionModel model6 = new CurrentMissionModel("Mission 6", 
                ProgramStatus.SCHEDULED, "Template 6", (long)0, (long)0);
        CurrentMissionModel model7 = new CurrentMissionModel("Mission 7", 
                ProgramStatus.SCRIPT_ERROR, "Template 7", (long)0, (long)0);
        CurrentMissionModel model8 = new CurrentMissionModel("Mission 8", 
                ProgramStatus.SHUTDOWN, "Template 8", (long)0, (long)0);
        CurrentMissionModel model9 = new CurrentMissionModel("Mission 9", 
                ProgramStatus.SHUTTING_DOWN, "Template 9", (long)0, (long)0);
        CurrentMissionModel model10 = new CurrentMissionModel("Mission 10", 
                ProgramStatus.UNSATISFIED, "Template 10", (long)0, (long)0);
        CurrentMissionModel model11 = new CurrentMissionModel("Mission 11", 
                ProgramStatus.VARIABLE_ERROR, "Template 11", (long)0, (long)0);
        CurrentMissionModel model12 = new CurrentMissionModel("Mission 12", 
                ProgramStatus.WAITING_INITIALIZED, "Template 12", (long)0, (long)0);
        CurrentMissionModel model13 = new CurrentMissionModel("Mission 13", 
                ProgramStatus.WAITING_UNINITIALIZED, "Template 13", (long)0, (long)0);
        
        List<CurrentMissionModel> models = new ArrayList<CurrentMissionModel>();
        models.add(model1);
        models.add(model2);
        models.add(model3);
        models.add(model4);
        models.add(model5);
        models.add(model6);
        models.add(model7);
        models.add(model8);
        models.add(model9);
        models.add(model10);
        models.add(model11);
        models.add(model12);
        models.add(model13);
        
        when(m_CurrentMgr.getCurrentMissionsForControllerAsync(123)).thenReturn(models);
        
        //test that all missions are returned
        assertThat(m_SUT.getCurrentFilteredMissions(123).size(), is(13));
        
        //setFilters and makes sure only a subset are returned 
        List<ProgramStatus> statuses = new ArrayList<ProgramStatus>();
        statuses.add(ProgramStatus.EXECUTING);
        statuses.add(ProgramStatus.SHUTDOWN);
        statuses.add(ProgramStatus.UNSATISFIED);
        
        m_SUT.setMissionFilters(statuses);
        
        //test that only the three missions are returned
        List<CurrentMissionModel> filteredModels = m_SUT.getCurrentFilteredMissions(123); 
        
        //6 are returned because error statuses are always shown, even thought they aren't
        //specified in the filter list.
        assertThat(filteredModels.size(), is(6));
        
        for(CurrentMissionModel fModel : filteredModels)
        {
            if (!fModel.getMissionName().equals("Mission 3") && !fModel.getMissionName().equals("Mission 5")
                    && !fModel.getMissionName().equals("Mission 7") && !fModel.getMissionName().equals("Mission 8")
                    && !fModel.getMissionName().equals("Mission 10") && !fModel.getMissionName().equals("Mission 11"))
            {
                fail("A mission was returned that is not expected. The mission name was " + fModel.getMissionName() 
                        + " and had a program status of " + fModel.getMissionStatus());
            }
        }
    }
/*
     * Test that correct missions are returned based on the current filters
     * that are stored by the CurrentMissionRequest object.
     * 
     * 1. No missions so none returned
     * 2. All missions returned because filter contains all types
     * 3. Subset of missions based on filters
     */
Test that correct missions are returned based on the current filters
that are stored by the CurrentMissionRequest object.

1. No missions so none returned
2. All missions returned because filter contains all types
3. Subset of missions based on filters
Test that correct missions are returned based on the current filters that are stored by the CurrentMissionRequest object . 1 . No missions so none returned 2 . All missions returned because filter contains all types 3 . Subset of missions based on filters
@Test
    public void testGetCurrentFilteredMissions()
    {
        assertThat(m_SUT.getCurrentFilteredMissions(123).size(), is(0));
        CurrentMissionModel model1 = new CurrentMissionModel("Mission 1", 
                ProgramStatus.CANCELED, "Template 1", (long)0, (long)0);
        CurrentMissionModel model2 = new CurrentMissionModel("Mission 2", 
                ProgramStatus.EXECUTED, "Template 2", (long)0, (long)0);
        CurrentMissionModel model3 = new CurrentMissionModel("Mission 3", 
                ProgramStatus.EXECUTING, "Template 3", (long)0, (long)0);
        CurrentMissionModel model4 = new CurrentMissionModel("Mission 4", 
                ProgramStatus.EXECUTING_TEST, "Template 4", (long)0, (long)0);
        CurrentMissionModel model5 = new CurrentMissionModel("Mission 5", 
                ProgramStatus.INITIALIZATION_ERROR, "Template 5", (long)0, (long)0);
        CurrentMissionModel model6 = new CurrentMissionModel("Mission 6", 
                ProgramStatus.SCHEDULED, "Template 6", (long)0, (long)0);
        CurrentMissionModel model7 = new CurrentMissionModel("Mission 7", 
                ProgramStatus.SCRIPT_ERROR, "Template 7", (long)0, (long)0);
        CurrentMissionModel model8 = new CurrentMissionModel("Mission 8", 
                ProgramStatus.SHUTDOWN, "Template 8", (long)0, (long)0);
        CurrentMissionModel model9 = new CurrentMissionModel("Mission 9", 
                ProgramStatus.SHUTTING_DOWN, "Template 9", (long)0, (long)0);
        CurrentMissionModel model10 = new CurrentMissionModel("Mission 10", 
                ProgramStatus.UNSATISFIED, "Template 10", (long)0, (long)0);
        CurrentMissionModel model11 = new CurrentMissionModel("Mission 11", 
                ProgramStatus.VARIABLE_ERROR, "Template 11", (long)0, (long)0);
        CurrentMissionModel model12 = new CurrentMissionModel("Mission 12", 
                ProgramStatus.WAITING_INITIALIZED, "Template 12", (long)0, (long)0);
        CurrentMissionModel model13 = new CurrentMissionModel("Mission 13", 
                ProgramStatus.WAITING_UNINITIALIZED, "Template 13", (long)0, (long)0);
        List<CurrentMissionModel> models = new ArrayList<CurrentMissionModel>();
        models.add(model1);
        models.add(model2);
        models.add(model3);
        models.add(model4);
        models.add(model5);
        models.add(model6);
        models.add(model7);
        models.add(model8);
        models.add(model9);
        models.add(model10);
        models.add(model11);
        models.add(model12);
        models.add(model13);
        when(m_CurrentMgr.getCurrentMissionsForControllerAsync(123)).thenReturn(models);
        assertThat(m_SUT.getCurrentFilteredMissions(123).size(), is(13));
        List<ProgramStatus> statuses = new ArrayList<ProgramStatus>();
        statuses.add(ProgramStatus.EXECUTING);
        statuses.add(ProgramStatus.SHUTDOWN);
        statuses.add(ProgramStatus.UNSATISFIED);
        m_SUT.setMissionFilters(statuses);
        List<CurrentMissionModel> filteredModels = m_SUT.getCurrentFilteredMissions(123); 
        assertThat(filteredModels.size(), is(6));
        for(CurrentMissionModel fModel : filteredModels)
        {
            if (!fModel.getMissionName().equals("Mission 3") && !fModel.getMissionName().equals("Mission 5")
                    && !fModel.getMissionName().equals("Mission 7") && !fModel.getMissionName().equals("Mission 8")
                    && !fModel.getMissionName().equals("Mission 10") && !fModel.getMissionName().equals("Mission 11"))
            {
                fail("A mission was returned that is not expected. The mission name was " + fModel.getMissionName() 
                        + " and had a program status of " + fModel.getMissionStatus());
            }
        }
    }
@ Test public void testGetCurrentFilteredMissions ( ) { assertThat ( m_SUT . getCurrentFilteredMissions ( 123 ) . size ( ) , is ( 0 ) ) ; CurrentMissionModel model1 = new CurrentMissionModel ( "Mission 1" , ProgramStatus . CANCELED , "Template 1" , ( long ) 0 , ( long ) 0 ) ; CurrentMissionModel model2 = new CurrentMissionModel ( "Mission 2" , ProgramStatus . EXECUTED , "Template 2" , ( long ) 0 , ( long ) 0 ) ; CurrentMissionModel model3 = new CurrentMissionModel ( "Mission 3" , ProgramStatus . EXECUTING , "Template 3" , ( long ) 0 , ( long ) 0 ) ; CurrentMissionModel model4 = new CurrentMissionModel ( "Mission 4" , ProgramStatus . EXECUTING_TEST , "Template 4" , ( long ) 0 , ( long ) 0 ) ; CurrentMissionModel model5 = new CurrentMissionModel ( "Mission 5" , ProgramStatus . INITIALIZATION_ERROR , "Template 5" , ( long ) 0 , ( long ) 0 ) ; CurrentMissionModel model6 = new CurrentMissionModel ( "Mission 6" , ProgramStatus . SCHEDULED , "Template 6" , ( long ) 0 , ( long ) 0 ) ; CurrentMissionModel model7 = new CurrentMissionModel ( "Mission 7" , ProgramStatus . SCRIPT_ERROR , "Template 7" , ( long ) 0 , ( long ) 0 ) ; CurrentMissionModel model8 = new CurrentMissionModel ( "Mission 8" , ProgramStatus . SHUTDOWN , "Template 8" , ( long ) 0 , ( long ) 0 ) ; CurrentMissionModel model9 = new CurrentMissionModel ( "Mission 9" , ProgramStatus . SHUTTING_DOWN , "Template 9" , ( long ) 0 , ( long ) 0 ) ; CurrentMissionModel model10 = new CurrentMissionModel ( "Mission 10" , ProgramStatus . UNSATISFIED , "Template 10" , ( long ) 0 , ( long ) 0 ) ; CurrentMissionModel model11 = new CurrentMissionModel ( "Mission 11" , ProgramStatus . VARIABLE_ERROR , "Template 11" , ( long ) 0 , ( long ) 0 ) ; CurrentMissionModel model12 = new CurrentMissionModel ( "Mission 12" , ProgramStatus . WAITING_INITIALIZED , "Template 12" , ( long ) 0 , ( long ) 0 ) ; CurrentMissionModel model13 = new CurrentMissionModel ( "Mission 13" , ProgramStatus . WAITING_UNINITIALIZED , "Template 13" , ( long ) 0 , ( long ) 0 ) ; List < CurrentMissionModel > models = new ArrayList < CurrentMissionModel > ( ) ; models . add ( model1 ) ; models . add ( model2 ) ; models . add ( model3 ) ; models . add ( model4 ) ; models . add ( model5 ) ; models . add ( model6 ) ; models . add ( model7 ) ; models . add ( model8 ) ; models . add ( model9 ) ; models . add ( model10 ) ; models . add ( model11 ) ; models . add ( model12 ) ; models . add ( model13 ) ; when ( m_CurrentMgr . getCurrentMissionsForControllerAsync ( 123 ) ) . thenReturn ( models ) ; assertThat ( m_SUT . getCurrentFilteredMissions ( 123 ) . size ( ) , is ( 13 ) ) ; List < ProgramStatus > statuses = new ArrayList < ProgramStatus > ( ) ; statuses . add ( ProgramStatus . EXECUTING ) ; statuses . add ( ProgramStatus . SHUTDOWN ) ; statuses . add ( ProgramStatus . UNSATISFIED ) ; m_SUT . setMissionFilters ( statuses ) ; List < CurrentMissionModel > filteredModels = m_SUT . getCurrentFilteredMissions ( 123 ) ; assertThat ( filteredModels . size ( ) , is ( 6 ) ) ; for ( CurrentMissionModel fModel : filteredModels ) { if ( ! fModel . getMissionName ( ) . equals ( "Mission 3" ) && ! fModel . getMissionName ( ) . equals ( "Mission 5" ) && ! fModel . getMissionName ( ) . equals ( "Mission 7" ) && ! fModel . getMissionName ( ) . equals ( "Mission 8" ) && ! fModel . getMissionName ( ) . equals ( "Mission 10" ) && ! fModel . getMissionName ( ) . equals ( "Mission 11" ) ) { fail ( "A mission was returned that is not expected. The mission name was " + fModel . getMissionName ( ) + " and had a program status of " + fModel . getMissionStatus ( ) ) ; } } }
Test that correct missions are returned based on the current filters
 that are stored by the CurrentMissionRequest object.
Test that correct missions are returned based on the current filters that are stored by the CurrentMissionRequest object .
//test that empty list is returned when no missions exist //test that all missions are returned //setFilters and makes sure only a subset are returned  //test that only the three missions are returned //6 are returned because error statuses are always shown, even thought they aren't //specified in the filter list.