mil.dod.th.ose.core/test/mil/dod/th/ose/core/factory/api/data/TestBaseFactoryObjectDataManager.java
@Test
    public void testClearPidPersistentStoreException() throws FactoryObjectInformationException, 
        IllegalArgumentException, PersistenceFailedException, ValidationFailedException
    {
        //mock factory object persistent data entry with valid data
        UUID uuid = UUID.randomUUID();
        FactoryObjectData factData = createFactoryObjectData("name", "pid");
        PersistentData persistentData = createPersistentData(uuid, factData.toByteArray());
    
        //mock exception for persistent data store
        doThrow(new PersistenceFailedException("FAILURE!!!")).when(m_PersistentDataStore).merge(persistentData);
    
        //run the method, expecting exception
        try
        {
            m_SUT.clearPid(uuid);
            fail("FactoryObjectInformationExceptionExpected");
        }
        catch (final FactoryObjectInformationException ex)
        {
            //exception expected, caused by persistence error - PersistenceFailed
            assertThat(ex.getCause().getClass().getName(), is(PersistenceFailedException.class.getName()));
        }
    }
/**
     * Verify that an exception is thrown if there is a problem merging with the persistent data store.
     * - Factory data is valid but merge cannot be completed. Exception caused by PersistentDataStore error.
     */
Verify that an exception is thrown if there is a problem merging with the persistent data store.
- Factory data is valid but merge cannot be completed. Exception caused by PersistentDataStore error.
Verify that an exception is thrown if there is a problem merging with the persistent data store . - Factory data is valid but merge cannot be completed . Exception caused by PersistentDataStore error .
@Test
    public void testClearPidPersistentStoreException() throws FactoryObjectInformationException, 
        IllegalArgumentException, PersistenceFailedException, ValidationFailedException
    {
        UUID uuid = UUID.randomUUID();
        FactoryObjectData factData = createFactoryObjectData("name", "pid");
        PersistentData persistentData = createPersistentData(uuid, factData.toByteArray());
        doThrow(new PersistenceFailedException("FAILURE!!!")).when(m_PersistentDataStore).merge(persistentData);
        try
        {
            m_SUT.clearPid(uuid);
            fail("FactoryObjectInformationExceptionExpected");
        }
        catch (final FactoryObjectInformationException ex)
        {
            assertThat(ex.getCause().getClass().getName(), is(PersistenceFailedException.class.getName()));
        }
    }
@ Test public void testClearPidPersistentStoreException ( ) throws FactoryObjectInformationException , IllegalArgumentException , PersistenceFailedException , ValidationFailedException { UUID uuid = UUID . randomUUID ( ) ; FactoryObjectData factData = createFactoryObjectData ( "name" , "pid" ) ; PersistentData persistentData = createPersistentData ( uuid , factData . toByteArray ( ) ) ; doThrow ( new PersistenceFailedException ( "FAILURE!!!" ) ) . when ( m_PersistentDataStore ) . merge ( persistentData ) ; try { m_SUT . clearPid ( uuid ) ; fail ( "FactoryObjectInformationExceptionExpected" ) ; } catch ( final FactoryObjectInformationException ex ) { assertThat ( ex . getCause ( ) . getClass ( ) . getName ( ) , is ( PersistenceFailedException . class . getName ( ) ) ) ; } }
Verify that an exception is thrown if there is a problem merging with the persistent data store.
Verify that an exception is thrown if there is a problem merging with the persistent data store .
//mock factory object persistent data entry with valid data //mock exception for persistent data store //run the method, expecting exception //exception expected, caused by persistence error - PersistenceFailed