mil.dod.th.ose.core/test/mil/dod/th/ose/core/factory/api/data/TestBaseFactoryObjectDataManager.java
@Test
    public void testPeristNewObjectUuidInUse() throws FactoryObjectInformationException
    {
        //mock some data
        UUID uuid = UUID.randomUUID();
        FactoryObjectData factData = createFactoryObjectData("storedGuy", null);
        createPersistentData(uuid, factData.toByteArray());
        
        //name to use
        String name = "noUniqueUuidForMe";
        FactoryDescriptor factory = mock(FactoryDescriptor.class);

        //call to persist new data
        try
        {
            m_SUT.persistNewObjectData(uuid, factory, name);
            fail("Expected exception, UUID is not unique.");
        }
        catch (IllegalArgumentException e)
        {
            //expected exception, UUID is already in use
        }
    }
/**
     * Verify case where the given UUID is already being used for persistNewObject.
     * - an IllegalArgumentException should be thrown.
     */
Verify case where the given UUID is already being used for persistNewObject.
- an IllegalArgumentException should be thrown.
Verify case where the given UUID is already being used for persistNewObject . - an IllegalArgumentException should be thrown .
@Test
    public void testPeristNewObjectUuidInUse() throws FactoryObjectInformationException
    {
        UUID uuid = UUID.randomUUID();
        FactoryObjectData factData = createFactoryObjectData("storedGuy", null);
        createPersistentData(uuid, factData.toByteArray());
        String name = "noUniqueUuidForMe";
        FactoryDescriptor factory = mock(FactoryDescriptor.class);
        try
        {
            m_SUT.persistNewObjectData(uuid, factory, name);
            fail("Expected exception, UUID is not unique.");
        }
        catch (IllegalArgumentException e)
        {
        }
    }
@ Test public void testPeristNewObjectUuidInUse ( ) throws FactoryObjectInformationException { UUID uuid = UUID . randomUUID ( ) ; FactoryObjectData factData = createFactoryObjectData ( "storedGuy" , null ) ; createPersistentData ( uuid , factData . toByteArray ( ) ) ; String name = "noUniqueUuidForMe" ; FactoryDescriptor factory = mock ( FactoryDescriptor . class ) ; try { m_SUT . persistNewObjectData ( uuid , factory , name ) ; fail ( "Expected exception, UUID is not unique." ) ; } catch ( IllegalArgumentException e ) { } }
Verify case where the given UUID is already being used for persistNewObject.
Verify case where the given UUID is already being used for persistNewObject .
//mock some data //name to use //call to persist new data //expected exception, UUID is already in use