mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/mp/TestProgramImpl.java
@Test
    public void testTestExecute() throws MissionProgramException, InterruptedException, ExecutionException
    {
        ProgramImpl program = createProgram("test");
        ArgumentCaptor<ProgramImpl> arguments = ArgumentCaptor.forClass(ProgramImpl.class);

        try
        {
            program.executeTest();
            fail("Expecting exception because the programs status needs to be waiting and initialized for"
                + " execution to take place");
        }
        catch (IllegalStateException ex)
        {
            //expected failure
        }

        //verify that the mission script's status is waiting, but uninitialized
        assertThat(program.getProgramStatus(), is(ProgramStatus.WAITING_UNINITIALIZED));

        //change the status and try again
        program.changeStatus(ProgramStatus.WAITING_INITIALIZED);
        
        @SuppressWarnings("unchecked")
        Future<TestResult> result = mock(Future.class);
        when(result.get()).thenReturn(TestResult.PASSED);

        //return value from mission program manager
        when(m_Manager.testProgram(program)).thenReturn(result);
        
        Future<TestResult> endResult = program.executeTest();
        verify(m_Manager).testProgram(arguments.capture());
        assertThat(arguments.getValue().getExecParams().size(), is(0));
        
        //verify result
        assertThat(endResult.get(), is(TestResult.PASSED));
    }
/**
     * Test that the program can be test executed.
     * 
     * Verify that if script initialization does not take place that the program will not execute.
     */
Test that the program can be test executed.

Verify that if script initialization does not take place that the program will not execute.
Test that the program can be test executed . Verify that if script initialization does not take place that the program will not execute .
@Test
    public void testTestExecute() throws MissionProgramException, InterruptedException, ExecutionException
    {
        ProgramImpl program = createProgram("test");
        ArgumentCaptor<ProgramImpl> arguments = ArgumentCaptor.forClass(ProgramImpl.class);
        try
        {
            program.executeTest();
            fail("Expecting exception because the programs status needs to be waiting and initialized for"
                + " execution to take place");
        }
        catch (IllegalStateException ex)
        {
        }
        assertThat(program.getProgramStatus(), is(ProgramStatus.WAITING_UNINITIALIZED));
        program.changeStatus(ProgramStatus.WAITING_INITIALIZED);
        @SuppressWarnings("unchecked")
        Future<TestResult> result = mock(Future.class);
        when(result.get()).thenReturn(TestResult.PASSED);
        when(m_Manager.testProgram(program)).thenReturn(result);
        Future<TestResult> endResult = program.executeTest();
        verify(m_Manager).testProgram(arguments.capture());
        assertThat(arguments.getValue().getExecParams().size(), is(0));
        assertThat(endResult.get(), is(TestResult.PASSED));
    }
@ Test public void testTestExecute ( ) throws MissionProgramException , InterruptedException , ExecutionException { ProgramImpl program = createProgram ( "test" ) ; ArgumentCaptor < ProgramImpl > arguments = ArgumentCaptor . forClass ( ProgramImpl . class ) ; try { program . executeTest ( ) ; fail ( "Expecting exception because the programs status needs to be waiting and initialized for" + " execution to take place" ) ; } catch ( IllegalStateException ex ) { } assertThat ( program . getProgramStatus ( ) , is ( ProgramStatus . WAITING_UNINITIALIZED ) ) ; program . changeStatus ( ProgramStatus . WAITING_INITIALIZED ) ; @ SuppressWarnings ( "unchecked" ) Future < TestResult > result = mock ( Future . class ) ; when ( result . get ( ) ) . thenReturn ( TestResult . PASSED ) ; when ( m_Manager . testProgram ( program ) ) . thenReturn ( result ) ; Future < TestResult > endResult = program . executeTest ( ) ; verify ( m_Manager ) . testProgram ( arguments . capture ( ) ) ; assertThat ( arguments . getValue ( ) . getExecParams ( ) . size ( ) , is ( 0 ) ) ; assertThat ( endResult . get ( ) , is ( TestResult . PASSED ) ) ; }
Test that the program can be test executed.
Test that the program can be test executed .
//expected failure //verify that the mission script's status is waiting, but uninitialized //change the status and try again //return value from mission program manager //verify result