mil.dod.th.ose.core/test/mil/dod/th/ose/core/factory/api/TestFactoryRegistry.java
@Test
    public void testGetObjectByUuidNoKnown() throws IllegalArgumentException, FactoryException,
        FactoryObjectInformationException
    {
        //UUIDs for objects
        UUID testUuid = UUID.randomUUID();
        UUID testUuid2 = UUID.randomUUID();
        UUID notKnownUuid = UUID.randomUUID();

        //mock behavior for creating object one and two
        FactoryObjectProxy factoryObjectProxy = mock(FactoryObjectProxy.class);
        FactoryObjectProxy factoryObjectProxy2 = mock(FactoryObjectProxy.class);

        ComponentInstance instance = mockComponentInstance(testUuid);
        ComponentInstance instance2 = mockComponentInstance(testUuid2);
        when(m_ServiceProxy.createFactoryObjectInternal(m_FactoryDescriptor)).thenReturn(instance, instance2);
        when(m_FactoryDescriptor.create()).thenReturn(factoryObjectProxy, factoryObjectProxy2);

        // replay
        FactoryObject objOne = m_SUT.createOrRestoreObject(m_FactoryDescriptor, testUuid);
        FactoryObject objTwo = m_SUT.createOrRestoreObject(m_FactoryDescriptor, testUuid2);

        //verify UUIDs for object one and two
        assertThat(m_SUT.getObjectByUuid(testUuid), is(objOne));
        assertThat(m_SUT.getObjectByUuid(testUuid2), is(objTwo));

        //verify exception for unknown UUID
        try
        {
            m_SUT.getObjectByUuid(notKnownUuid);
            fail("Expecting Exception");
        }
        catch (IllegalArgumentException e)
        {
            //expecting exception
        }
    }
/**
     * Test that attempting get an object by UUID when the UUID is not associated with an object known to the factory
     * registry.
     */
Test that attempting get an object by UUID when the UUID is not associated with an object known to the factory
registry.
Test that attempting get an object by UUID when the UUID is not associated with an object known to the factory registry .
@Test
    public void testGetObjectByUuidNoKnown() throws IllegalArgumentException, FactoryException,
        FactoryObjectInformationException
    {
        UUID testUuid = UUID.randomUUID();
        UUID testUuid2 = UUID.randomUUID();
        UUID notKnownUuid = UUID.randomUUID();
        FactoryObjectProxy factoryObjectProxy = mock(FactoryObjectProxy.class);
        FactoryObjectProxy factoryObjectProxy2 = mock(FactoryObjectProxy.class);
        ComponentInstance instance = mockComponentInstance(testUuid);
        ComponentInstance instance2 = mockComponentInstance(testUuid2);
        when(m_ServiceProxy.createFactoryObjectInternal(m_FactoryDescriptor)).thenReturn(instance, instance2);
        when(m_FactoryDescriptor.create()).thenReturn(factoryObjectProxy, factoryObjectProxy2);
        FactoryObject objOne = m_SUT.createOrRestoreObject(m_FactoryDescriptor, testUuid);
        FactoryObject objTwo = m_SUT.createOrRestoreObject(m_FactoryDescriptor, testUuid2);
        assertThat(m_SUT.getObjectByUuid(testUuid), is(objOne));
        assertThat(m_SUT.getObjectByUuid(testUuid2), is(objTwo));
        try
        {
            m_SUT.getObjectByUuid(notKnownUuid);
            fail("Expecting Exception");
        }
        catch (IllegalArgumentException e)
        {
        }
    }
@ Test public void testGetObjectByUuidNoKnown ( ) throws IllegalArgumentException , FactoryException , FactoryObjectInformationException { UUID testUuid = UUID . randomUUID ( ) ; UUID testUuid2 = UUID . randomUUID ( ) ; UUID notKnownUuid = UUID . randomUUID ( ) ; FactoryObjectProxy factoryObjectProxy = mock ( FactoryObjectProxy . class ) ; FactoryObjectProxy factoryObjectProxy2 = mock ( FactoryObjectProxy . class ) ; ComponentInstance instance = mockComponentInstance ( testUuid ) ; ComponentInstance instance2 = mockComponentInstance ( testUuid2 ) ; when ( m_ServiceProxy . createFactoryObjectInternal ( m_FactoryDescriptor ) ) . thenReturn ( instance , instance2 ) ; when ( m_FactoryDescriptor . create ( ) ) . thenReturn ( factoryObjectProxy , factoryObjectProxy2 ) ; FactoryObject objOne = m_SUT . createOrRestoreObject ( m_FactoryDescriptor , testUuid ) ; FactoryObject objTwo = m_SUT . createOrRestoreObject ( m_FactoryDescriptor , testUuid2 ) ; assertThat ( m_SUT . getObjectByUuid ( testUuid ) , is ( objOne ) ) ; assertThat ( m_SUT . getObjectByUuid ( testUuid2 ) , is ( objTwo ) ) ; try { m_SUT . getObjectByUuid ( notKnownUuid ) ; fail ( "Expecting Exception" ) ; } catch ( IllegalArgumentException e ) { } }
Test that attempting get an object by UUID when the UUID is not associated with an object known to the factory
 registry.
Test that attempting get an object by UUID when the UUID is not associated with an object known to the factory registry .
//UUIDs for objects //mock behavior for creating object one and two // replay //verify UUIDs for object one and two //verify exception for unknown UUID //expecting exception