mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestMissionProgramming.java
@Test
    public void testSimpleScriptTestExecutionFailed() throws Exception
    {
        //create parameters
        MissionProgramSchedule schedule = new MissionProgramSchedule().withIndefiniteInterval(false).
            withImmediately(false).withActive(true).withAtReset(false);
        MissionProgramParameters params = new MissionProgramParameters().withTemplateName("simple-fail-template").
            withSchedule(schedule).withParameters(new MapEntry("a", 5)).withProgramName("TestSimpleTest3");

        //wait for tested event
        EventHandlerSyncer syncer = new EventHandlerSyncer(m_Context, Program.TOPIC_PROGRAM_TESTED, 
            String.format(String.format("(%s=%s)", Program.EVENT_PROP_PROGRAM_NAME, "TestSimpleTest3")));

        Program program = m_MissionProgramManager.loadParameters(params);

        program.executeTest();

        //verify
        Event lastEvent = syncer.waitForEvent(15);

        //verify that the parameters were loaded successfully and created a valid Mission program that did not 
        //successfully execute
        assertThat(program.getProgramStatus(), is(ProgramStatus.WAITING_INITIALIZED));
        assertThat(program.getLastTestResult(), is(TestResult.FAILED));
        assertThat(lastEvent, is(notNullValue()));
        assertThat((String)lastEvent.getProperty(Program.EVENT_PROP_PROGRAM_TEST_RESULT_EXCEPTION), 
            containsString("I don't work"));
    }
/**
     * This tests that a simple script can execute its test function and that the event contains the exception.
     */
This tests that a simple script can execute its test function and that the event contains the exception.
This tests that a simple script can execute its test function and that the event contains the exception .
@Test
    public void testSimpleScriptTestExecutionFailed() throws Exception
    {
        MissionProgramSchedule schedule = new MissionProgramSchedule().withIndefiniteInterval(false).
            withImmediately(false).withActive(true).withAtReset(false);
        MissionProgramParameters params = new MissionProgramParameters().withTemplateName("simple-fail-template").
            withSchedule(schedule).withParameters(new MapEntry("a", 5)).withProgramName("TestSimpleTest3");
        EventHandlerSyncer syncer = new EventHandlerSyncer(m_Context, Program.TOPIC_PROGRAM_TESTED, 
            String.format(String.format("(%s=%s)", Program.EVENT_PROP_PROGRAM_NAME, "TestSimpleTest3")));
        Program program = m_MissionProgramManager.loadParameters(params);
        program.executeTest();
        Event lastEvent = syncer.waitForEvent(15);
         that the parameters were loaded successfully and created a valid Mission program that did not 
        assertThat(program.getProgramStatus(), is(ProgramStatus.WAITING_INITIALIZED));
        assertThat(program.getLastTestResult(), is(TestResult.FAILED));
        assertThat(lastEvent, is(notNullValue()));
        assertThat((String)lastEvent.getProperty(Program.EVENT_PROP_PROGRAM_TEST_RESULT_EXCEPTION), 
            containsString("I don't work"));
    }
@ Test public void testSimpleScriptTestExecutionFailed ( ) throws Exception { MissionProgramSchedule schedule = new MissionProgramSchedule ( ) . withIndefiniteInterval ( false ) . withImmediately ( false ) . withActive ( true ) . withAtReset ( false ) ; MissionProgramParameters params = new MissionProgramParameters ( ) . withTemplateName ( "simple-fail-template" ) . withSchedule ( schedule ) . withParameters ( new MapEntry ( "a" , 5 ) ) . withProgramName ( "TestSimpleTest3" ) ; EventHandlerSyncer syncer = new EventHandlerSyncer ( m_Context , Program . TOPIC_PROGRAM_TESTED , String . format ( String . format ( "(%s=%s)" , Program . EVENT_PROP_PROGRAM_NAME , "TestSimpleTest3" ) ) ) ; Program program = m_MissionProgramManager . loadParameters ( params ) ; program . executeTest ( ) ; Event lastEvent = syncer . waitForEvent ( 15 ) ; assertThat ( program . getProgramStatus ( ) , is ( ProgramStatus . WAITING_INITIALIZED ) ) ; assertThat ( program . getLastTestResult ( ) , is ( TestResult . FAILED ) ) ; assertThat ( lastEvent , is ( notNullValue ( ) ) ) ; assertThat ( ( String ) lastEvent . getProperty ( Program . EVENT_PROP_PROGRAM_TEST_RESULT_EXCEPTION ) , containsString ( "I don't work" ) ) ; }
This tests that a simple script can execute its test function and that the event contains the exception.
This tests that a simple script can execute its test function and that the event contains the exception .
//create parameters //wait for tested event //verify //verify that the parameters were loaded successfully and created a valid Mission program that did not  //successfully execute