mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/mp/TestTemplateProgramManagerImpl.java
@Test
    public void testBadLoadFromFile() throws IOException, IllegalArgumentException, PersistenceFailedException, 
        ValidationFailedException, UnmarshalException
    {
        //activate the manager
        m_SUT.activate(context);
        
        //mock URL
        URL url = new URL("file:asdf");
        
        //mock behavior
        when(m_UnmarshalService.getXmlObject(MissionProgramTemplate.class, url)).thenThrow(
                new UnmarshalException("Bad template!!")); 
        
        try
        {
            m_SUT.loadFromFile(url, false);
            fail("Expected Exception");
        }
        catch (UnmarshalException e)
        {
            
        }
    }
/**
     * Test loading from file an XML object that is NOT well-formed.
     */
Test loading from file an XML object that is NOT well-formed.
Test loading from file an XML object that is NOT well - formed .
@Test
    public void testBadLoadFromFile() throws IOException, IllegalArgumentException, PersistenceFailedException, 
        ValidationFailedException, UnmarshalException
    {
        m_SUT.activate(context);
        URL url = new URL("file:asdf");
        when(m_UnmarshalService.getXmlObject(MissionProgramTemplate.class, url)).thenThrow(
                new UnmarshalException("Bad template!!")); 
        try
        {
            m_SUT.loadFromFile(url, false);
            fail("Expected Exception");
        }
        catch (UnmarshalException e)
        {
        }
    }
@ Test public void testBadLoadFromFile ( ) throws IOException , IllegalArgumentException , PersistenceFailedException , ValidationFailedException , UnmarshalException { m_SUT . activate ( context ) ; URL url = new URL ( "file:asdf" ) ; when ( m_UnmarshalService . getXmlObject ( MissionProgramTemplate . class , url ) ) . thenThrow ( new UnmarshalException ( "Bad template!!" ) ) ; try { m_SUT . loadFromFile ( url , false ) ; fail ( "Expected Exception" ) ; } catch ( UnmarshalException e ) { } }
Test loading from file an XML object that is NOT well-formed.
Test loading from file an XML object that is NOT well - formed .
//activate the manager //mock URL //mock behavior