mil.dod.th.ose.core/test/mil/dod/th/ose/core/factory/api/TestFactoryRegistry.java
@Test
    public void testFindObjectByName() throws IllegalArgumentException, FactoryObjectInformationException,
        FactoryException
    {
        // mock a factory object
        UUID testUuid = UUID.randomUUID();
        FactoryObjectProxy testObjProxy = mock(FactoryObjectProxy.class);

        // set up fake object factory
        FactoryInternal factory = mock(FactoryInternal.class);
        when(factory.create()).thenReturn(testObjProxy);

        ComponentInstance instance = mockComponentInstance(testUuid, "name", "pid");
        when(m_ServiceProxy.createFactoryObjectInternal(factory)).thenReturn(instance);

        when(m_Utils.getMetaTypeDefaults(factory)).thenReturn(new Hashtable<String, Object>());

        // replay
        FactoryObjectInternal obj = m_SUT.createOrRestoreObject(factory, testUuid);

        assertThat(m_SUT.findObjectByName("name"), is(obj));
    }
/**
     * Verify ability to find an object by name.
     */
Verify ability to find an object by name.
Verify ability to find an object by name .
@Test
    public void testFindObjectByName() throws IllegalArgumentException, FactoryObjectInformationException,
        FactoryException
    {
        UUID testUuid = UUID.randomUUID();
        FactoryObjectProxy testObjProxy = mock(FactoryObjectProxy.class);
        FactoryInternal factory = mock(FactoryInternal.class);
        when(factory.create()).thenReturn(testObjProxy);
        ComponentInstance instance = mockComponentInstance(testUuid, "name", "pid");
        when(m_ServiceProxy.createFactoryObjectInternal(factory)).thenReturn(instance);
        when(m_Utils.getMetaTypeDefaults(factory)).thenReturn(new Hashtable<String, Object>());
        FactoryObjectInternal obj = m_SUT.createOrRestoreObject(factory, testUuid);
        assertThat(m_SUT.findObjectByName("name"), is(obj));
    }
@ Test public void testFindObjectByName ( ) throws IllegalArgumentException , FactoryObjectInformationException , FactoryException { UUID testUuid = UUID . randomUUID ( ) ; FactoryObjectProxy testObjProxy = mock ( FactoryObjectProxy . class ) ; FactoryInternal factory = mock ( FactoryInternal . class ) ; when ( factory . create ( ) ) . thenReturn ( testObjProxy ) ; ComponentInstance instance = mockComponentInstance ( testUuid , "name" , "pid" ) ; when ( m_ServiceProxy . createFactoryObjectInternal ( factory ) ) . thenReturn ( instance ) ; when ( m_Utils . getMetaTypeDefaults ( factory ) ) . thenReturn ( new Hashtable < String , Object > ( ) ) ; FactoryObjectInternal obj = m_SUT . createOrRestoreObject ( factory , testUuid ) ; assertThat ( m_SUT . findObjectByName ( "name" ) , is ( obj ) ) ; }
Verify ability to find an object by name.
Verify ability to find an object by name .
// mock a factory object // set up fake object factory // replay