mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/mp/TestMissionProgramManagerImpl.java
@Test
    public void testActivateAndAddAsset() 
        throws IllegalArgumentException, PersistenceFailedException, MissionProgramException
    {
        // mock
        mockMissionProgramPersistentData();
        mockTemplates();
        
        // replay
        setScriptEngineAndActivate();
        
        MissionProgramTemplate program = new MissionProgramTemplate().withName("blah").withSource("asdf");
        Set<String> templateNames = new HashSet<String>();
        templateNames.add("blah");
        when(m_TemplateManager.getMissionTemplateNames()).thenReturn(templateNames);
        doReturn(program).when(m_TemplateManager).getTemplate("blah");
        MissionProgramSchedule schedule = new MissionProgramSchedule().withImmediately(false).
            withIndefiniteInterval(false).withActive(true);
        MissionProgramParameters params = new MissionProgramParameters().withParameters().withTemplateName("blah").
            withSchedule(schedule).withProgramName("name");        
        m_SUT.loadParameters(params);
        
        //verify
        verify(m_PersistentDataStore).persist(eq(MissionProgramManagerImpl.class), (UUID)Mockito.any(), 
                eq("blah"), (Serializable)Mockito.any());
        
        assertThat(m_SUT.getActiveProgramTemplateNames(), hasItem("blah"));
    }
/**
     *  Verify mpm activates and template is added when asset is added.
     */
Verify mpm activates and template is added when asset is added.
Verify mpm activates and template is added when asset is added .
@Test
    public void testActivateAndAddAsset() 
        throws IllegalArgumentException, PersistenceFailedException, MissionProgramException
    {
        mockMissionProgramPersistentData();
        mockTemplates();
        setScriptEngineAndActivate();
        MissionProgramTemplate program = new MissionProgramTemplate().withName("blah").withSource("asdf");
        Set<String> templateNames = new HashSet<String>();
        templateNames.add("blah");
        when(m_TemplateManager.getMissionTemplateNames()).thenReturn(templateNames);
        doReturn(program).when(m_TemplateManager).getTemplate("blah");
        MissionProgramSchedule schedule = new MissionProgramSchedule().withImmediately(false).
            withIndefiniteInterval(false).withActive(true);
        MissionProgramParameters params = new MissionProgramParameters().withParameters().withTemplateName("blah").
            withSchedule(schedule).withProgramName("name");        
        m_SUT.loadParameters(params);
        verify(m_PersistentDataStore).persist(eq(MissionProgramManagerImpl.class), (UUID)Mockito.any(), 
                eq("blah"), (Serializable)Mockito.any());
        assertThat(m_SUT.getActiveProgramTemplateNames(), hasItem("blah"));
    }
@ Test public void testActivateAndAddAsset ( ) throws IllegalArgumentException , PersistenceFailedException , MissionProgramException { mockMissionProgramPersistentData ( ) ; mockTemplates ( ) ; setScriptEngineAndActivate ( ) ; MissionProgramTemplate program = new MissionProgramTemplate ( ) . withName ( "blah" ) . withSource ( "asdf" ) ; Set < String > templateNames = new HashSet < String > ( ) ; templateNames . add ( "blah" ) ; when ( m_TemplateManager . getMissionTemplateNames ( ) ) . thenReturn ( templateNames ) ; doReturn ( program ) . when ( m_TemplateManager ) . getTemplate ( "blah" ) ; MissionProgramSchedule schedule = new MissionProgramSchedule ( ) . withImmediately ( false ) . withIndefiniteInterval ( false ) . withActive ( true ) ; MissionProgramParameters params = new MissionProgramParameters ( ) . withParameters ( ) . withTemplateName ( "blah" ) . withSchedule ( schedule ) . withProgramName ( "name" ) ; m_SUT . loadParameters ( params ) ; verify ( m_PersistentDataStore ) . persist ( eq ( MissionProgramManagerImpl . class ) , ( UUID ) Mockito . any ( ) , eq ( "blah" ) , ( Serializable ) Mockito . any ( ) ) ; assertThat ( m_SUT . getActiveProgramTemplateNames ( ) , hasItem ( "blah" ) ) ; }
Verify mpm activates and template is added when asset is added.
Verify mpm activates and template is added when asset is added .
// mock // replay //verify