mil.dod.th.ose.core/test/mil/dod/th/ose/core/factory/api/TestFactoryRegistry.java
@Test
    public void testSetName() throws IllegalArgumentException,
        FactoryException, FactoryObjectInformationException
    {
        // mock a factory object
        UUID testUuid = UUID.randomUUID();
        createMockFactObj(testUuid, "DefaultName", null);
        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
        m_SUT.createOrRestoreObject(factory, testUuid);

        //update the name
        m_SUT.setName(testUuid, "name");

        //verify new entry created with correct name
        verify(m_FactoryObjectDataManager).setName(testUuid, "name");
    }
/**
     * Test the setting of a name triggers the entity to merge.
     * Verify name update and merging call.
     */
Test the setting of a name triggers the entity to merge.
Verify name update and merging call.
Test the setting of a name triggers the entity to merge . Verify name update and merging call .
@Test
    public void testSetName() throws IllegalArgumentException,
        FactoryException, FactoryObjectInformationException
    {
        UUID testUuid = UUID.randomUUID();
        createMockFactObj(testUuid, "DefaultName", null);
        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>());
        m_SUT.createOrRestoreObject(factory, testUuid);
        m_SUT.setName(testUuid, "name");
        verify(m_FactoryObjectDataManager).setName(testUuid, "name");
    }
@ Test public void testSetName ( ) throws IllegalArgumentException , FactoryException , FactoryObjectInformationException { UUID testUuid = UUID . randomUUID ( ) ; createMockFactObj ( testUuid , "DefaultName" , null ) ; 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 > ( ) ) ; m_SUT . createOrRestoreObject ( factory , testUuid ) ; m_SUT . setName ( testUuid , "name" ) ; verify ( m_FactoryObjectDataManager ) . setName ( testUuid , "name" ) ; }
Test the setting of a name triggers the entity to merge.
Test the setting of a name triggers the entity to merge .
// mock a factory object // set up fake object factory // replay //update the name //verify new entry created with correct name