mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/mp/TestMissionProgramSchedulerImpl.java
@Test
    public void testShutdownProgramException() throws InterruptedException, PrivilegedActionException
    {
        m_SUT.activate();
        doThrow(new PrivilegedActionException(new Exception("I am an Exception"))).when(m_Script).shutdown();
        m_SUT.shutdownProgram(m_Program1);
        
        Thread.sleep(100);
        
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        //once for shutdown topic (mocked status changes do not post events)
        verify(m_EventAdmin, times (1)).postEvent(eventCaptor.capture());
        
        assertThat(eventCaptor.getValue().getTopic(), 
                is(Program.TOPIC_PROGRAM_SHUTDOWN_FAILURE));
        assertProgramEventProps(eventCaptor.getValue(), m_Program1);
    }
/**
     * Test shutting down a program and an exception is incurred.
     * Verify further attempts.
     * Verify stop after time out.
     */
Test shutting down a program and an exception is incurred.
Verify further attempts.
Verify stop after time out.
Test shutting down a program and an exception is incurred . Verify further attempts . Verify stop after time out .
@Test
    public void testShutdownProgramException() throws InterruptedException, PrivilegedActionException
    {
        m_SUT.activate();
        doThrow(new PrivilegedActionException(new Exception("I am an Exception"))).when(m_Script).shutdown();
        m_SUT.shutdownProgram(m_Program1);
        Thread.sleep(100);
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin, times (1)).postEvent(eventCaptor.capture());
        assertThat(eventCaptor.getValue().getTopic(), 
                is(Program.TOPIC_PROGRAM_SHUTDOWN_FAILURE));
        assertProgramEventProps(eventCaptor.getValue(), m_Program1);
    }
@ Test public void testShutdownProgramException ( ) throws InterruptedException , PrivilegedActionException { m_SUT . activate ( ) ; doThrow ( new PrivilegedActionException ( new Exception ( "I am an Exception" ) ) ) . when ( m_Script ) . shutdown ( ) ; m_SUT . shutdownProgram ( m_Program1 ) ; Thread . sleep ( 100 ) ; ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin , times ( 1 ) ) . postEvent ( eventCaptor . capture ( ) ) ; assertThat ( eventCaptor . getValue ( ) . getTopic ( ) , is ( Program . TOPIC_PROGRAM_SHUTDOWN_FAILURE ) ) ; assertProgramEventProps ( eventCaptor . getValue ( ) , m_Program1 ) ; }
Test shutting down a program and an exception is incurred.
Test shutting down a program and an exception is incurred .
//once for shutdown topic (mocked status changes do not post events)