mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/mp/TestMissionProgramManagerImpl.java
@Test
    public void testGetPrograms() throws ValidationFailedException, MissionProgramException, 
        PersistenceFailedException
    {
        //mock data
        mockMissionProgramPersistentData();
        mockTemplates();

        setScriptEngineAndActivate();
        
        //program to add
        Map<String, Object> arguments = new HashMap<String, Object>();
        arguments.put("arg1", "test-value");
        arguments.put("arg2", 5);
        MissionProgramTemplate program = new MissionProgramTemplate().withName("test").withSource("something");
        MissionProgramSchedule schedule = new MissionProgramSchedule().withImmediately(false).
            withIndefiniteInterval(false).withActive(false);
        MissionProgramParameters params = new MissionProgramParameters().withTemplateName("test").
            withParameters(MapTranslator.translateMap(arguments)).withSchedule(schedule).withProgramName("iokk");

        //test getting the 
        doReturn(program).when(m_TemplateManager).getTemplate("test");
        Program mission = m_SUT.loadParameters(params);

        //five templates are mocked in the 'mockTemplates'
        List<Program> programs = new ArrayList<Program>(m_SUT.getPrograms());

        //grab the program added check that its name is assigned since one is not specified in the
        //params
        int indexOfAddedProg = programs.indexOf(mission);
        Program programFromList = programs.get(indexOfAddedProg);
        assertThat(programFromList.getProgramName().isEmpty(), is(false));

        //verify getting a program by name
        assertThat(m_SUT.getProgram(programFromList.getProgramName()), is(mission));
    }
/**
     * Test getting a specific program by name.
     * 
     * Verify that all mock templates are returned for the getPrograms request.
     * 
     * Verify that if getProgram using a name returns the expected result.
     */
Test getting a specific program by name.

Verify that all mock templates are returned for the getPrograms request.

Verify that if getProgram using a name returns the expected result.
Test getting a specific program by name . Verify that all mock templates are returned for the getPrograms request . Verify that if getProgram using a name returns the expected result .
@Test
    public void testGetPrograms() throws ValidationFailedException, MissionProgramException, 
        PersistenceFailedException
    {
        mockMissionProgramPersistentData();
        mockTemplates();
        setScriptEngineAndActivate();
        Map<String, Object> arguments = new HashMap<String, Object>();
        arguments.put("arg1", "test-value");
        arguments.put("arg2", 5);
        MissionProgramTemplate program = new MissionProgramTemplate().withName("test").withSource("something");
        MissionProgramSchedule schedule = new MissionProgramSchedule().withImmediately(false).
            withIndefiniteInterval(false).withActive(false);
        MissionProgramParameters params = new MissionProgramParameters().withTemplateName("test").
            withParameters(MapTranslator.translateMap(arguments)).withSchedule(schedule).withProgramName("iokk");
        doReturn(program).when(m_TemplateManager).getTemplate("test");
        Program mission = m_SUT.loadParameters(params);
        List<Program> programs = new ArrayList<Program>(m_SUT.getPrograms());
        int indexOfAddedProg = programs.indexOf(mission);
        Program programFromList = programs.get(indexOfAddedProg);
        assertThat(programFromList.getProgramName().isEmpty(), is(false));
        assertThat(m_SUT.getProgram(programFromList.getProgramName()), is(mission));
    }
@ Test public void testGetPrograms ( ) throws ValidationFailedException , MissionProgramException , PersistenceFailedException { mockMissionProgramPersistentData ( ) ; mockTemplates ( ) ; setScriptEngineAndActivate ( ) ; Map < String , Object > arguments = new HashMap < String , Object > ( ) ; arguments . put ( "arg1" , "test-value" ) ; arguments . put ( "arg2" , 5 ) ; MissionProgramTemplate program = new MissionProgramTemplate ( ) . withName ( "test" ) . withSource ( "something" ) ; MissionProgramSchedule schedule = new MissionProgramSchedule ( ) . withImmediately ( false ) . withIndefiniteInterval ( false ) . withActive ( false ) ; MissionProgramParameters params = new MissionProgramParameters ( ) . withTemplateName ( "test" ) . withParameters ( MapTranslator . translateMap ( arguments ) ) . withSchedule ( schedule ) . withProgramName ( "iokk" ) ; doReturn ( program ) . when ( m_TemplateManager ) . getTemplate ( "test" ) ; Program mission = m_SUT . loadParameters ( params ) ; List < Program > programs = new ArrayList < Program > ( m_SUT . getPrograms ( ) ) ; int indexOfAddedProg = programs . indexOf ( mission ) ; Program programFromList = programs . get ( indexOfAddedProg ) ; assertThat ( programFromList . getProgramName ( ) . isEmpty ( ) , is ( false ) ) ; assertThat ( m_SUT . getProgram ( programFromList . getProgramName ( ) ) , is ( mission ) ) ; }
Test getting a specific program by name.
Test getting a specific program by name .
//mock data //program to add //test getting the  //five templates are mocked in the 'mockTemplates' //grab the program added check that its name is assigned since one is not specified in the //params //verify getting a program by name