mil.dod.th.ose.core/test/mil/dod/th/ose/core/factory/api/TestFactoryRegistry.java
@SuppressWarnings("unchecked")
    @Test
    public void testCreateNewObjectNullName() throws IllegalArgumentException,
        FactoryObjectInformationException, FactoryException, ConfigurationException
    {
        ComponentInstance instance = mockComponentInstance(UUID.randomUUID(), "name", null);
        FactoryObjectInternal fInternal = (FactoryObjectInternal)instance.getInstance();
        FactoryObjectProxy proxy = mock(FactoryObjectProxy.class);

        when(m_FactoryDescriptor.create()).thenReturn(proxy);
        when(m_FactoryDescriptor.getProductType()).thenReturn("some.package.SomeClass");
        when(m_FactoryObjectDataManager.getPersistentUuid("name")).thenReturn(null);
        when(m_FactoryObjectDataManager.getPid(Mockito.any(UUID.class))).thenReturn(null);
        when(m_FactoryObjectDataManager.getName(Mockito.any(UUID.class))).
            thenReturn(FactoryObjectProxy.class.getSimpleName());
        when(m_ServiceProxy.createFactoryObjectInternal(m_FactoryDescriptor)).thenReturn(instance);

        m_SUT.createNewObject(m_FactoryDescriptor, null, new Hashtable<String, Object>());

        verify(m_FactoryObjectDataManager).persistNewObjectData(Mockito.any(UUID.class),
                eq(m_FactoryDescriptor), eq("SomeClass"));

        verify(m_ServiceProxy).createFactoryObjectInternal(m_FactoryDescriptor);
        verify(m_FactoryDescriptor).create();

        InOrder inOrder = inOrder(m_Callback, m_ServiceProxy, fInternal);
        inOrder.verify(fInternal).initialize(eq(m_SUT), eq(proxy), eq(m_FactoryDescriptor),
                eq(m_ConfigAdmin), eq(m_EventAdmin), eq(m_PowerInternal),
                Mockito.any(UUID.class), eq(FactoryObjectProxy.class.getSimpleName()), Mockito.anyString(),
                Mockito.anyString());

        inOrder.verify(m_Callback).preObjectInitialize(fInternal);

        inOrder.verify(m_ServiceProxy).initializeProxy(eq(fInternal), eq(proxy), Mockito.anyMap());

        inOrder.verify(m_Callback).postObjectInitialize(fInternal);
    }
/**
     * Verify if no name is passed in that an object is created with the name being the
     * name of the proxy class.
     */
Verify if no name is passed in that an object is created with the name being the
name of the proxy class.
Verify if no name is passed in that an object is created with the name being the name of the proxy class .
@SuppressWarnings("unchecked")
    @Test
    public void testCreateNewObjectNullName() throws IllegalArgumentException,
        FactoryObjectInformationException, FactoryException, ConfigurationException
    {
        ComponentInstance instance = mockComponentInstance(UUID.randomUUID(), "name", null);
        FactoryObjectInternal fInternal = (FactoryObjectInternal)instance.getInstance();
        FactoryObjectProxy proxy = mock(FactoryObjectProxy.class);
        when(m_FactoryDescriptor.create()).thenReturn(proxy);
        when(m_FactoryDescriptor.getProductType()).thenReturn("some.package.SomeClass");
        when(m_FactoryObjectDataManager.getPersistentUuid("name")).thenReturn(null);
        when(m_FactoryObjectDataManager.getPid(Mockito.any(UUID.class))).thenReturn(null);
        when(m_FactoryObjectDataManager.getName(Mockito.any(UUID.class))).
            thenReturn(FactoryObjectProxy.class.getSimpleName());
        when(m_ServiceProxy.createFactoryObjectInternal(m_FactoryDescriptor)).thenReturn(instance);
        m_SUT.createNewObject(m_FactoryDescriptor, null, new Hashtable<String, Object>());
        verify(m_FactoryObjectDataManager).persistNewObjectData(Mockito.any(UUID.class),
                eq(m_FactoryDescriptor), eq("SomeClass"));
        verify(m_ServiceProxy).createFactoryObjectInternal(m_FactoryDescriptor);
        verify(m_FactoryDescriptor).create();
        InOrder inOrder = inOrder(m_Callback, m_ServiceProxy, fInternal);
        inOrder.verify(fInternal).initialize(eq(m_SUT), eq(proxy), eq(m_FactoryDescriptor),
                eq(m_ConfigAdmin), eq(m_EventAdmin), eq(m_PowerInternal),
                Mockito.any(UUID.class), eq(FactoryObjectProxy.class.getSimpleName()), Mockito.anyString(),
                Mockito.anyString());
        inOrder.verify(m_Callback).preObjectInitialize(fInternal);
        inOrder.verify(m_ServiceProxy).initializeProxy(eq(fInternal), eq(proxy), Mockito.anyMap());
        inOrder.verify(m_Callback).postObjectInitialize(fInternal);
    }
@ SuppressWarnings ( "unchecked" ) @ Test public void testCreateNewObjectNullName ( ) throws IllegalArgumentException , FactoryObjectInformationException , FactoryException , ConfigurationException { ComponentInstance instance = mockComponentInstance ( UUID . randomUUID ( ) , "name" , null ) ; FactoryObjectInternal fInternal = ( FactoryObjectInternal ) instance . getInstance ( ) ; FactoryObjectProxy proxy = mock ( FactoryObjectProxy . class ) ; when ( m_FactoryDescriptor . create ( ) ) . thenReturn ( proxy ) ; when ( m_FactoryDescriptor . getProductType ( ) ) . thenReturn ( "some.package.SomeClass" ) ; when ( m_FactoryObjectDataManager . getPersistentUuid ( "name" ) ) . thenReturn ( null ) ; when ( m_FactoryObjectDataManager . getPid ( Mockito . any ( UUID . class ) ) ) . thenReturn ( null ) ; when ( m_FactoryObjectDataManager . getName ( Mockito . any ( UUID . class ) ) ) . thenReturn ( FactoryObjectProxy . class . getSimpleName ( ) ) ; when ( m_ServiceProxy . createFactoryObjectInternal ( m_FactoryDescriptor ) ) . thenReturn ( instance ) ; m_SUT . createNewObject ( m_FactoryDescriptor , null , new Hashtable < String , Object > ( ) ) ; verify ( m_FactoryObjectDataManager ) . persistNewObjectData ( Mockito . any ( UUID . class ) , eq ( m_FactoryDescriptor ) , eq ( "SomeClass" ) ) ; verify ( m_ServiceProxy ) . createFactoryObjectInternal ( m_FactoryDescriptor ) ; verify ( m_FactoryDescriptor ) . create ( ) ; InOrder inOrder = inOrder ( m_Callback , m_ServiceProxy , fInternal ) ; inOrder . verify ( fInternal ) . initialize ( eq ( m_SUT ) , eq ( proxy ) , eq ( m_FactoryDescriptor ) , eq ( m_ConfigAdmin ) , eq ( m_EventAdmin ) , eq ( m_PowerInternal ) , Mockito . any ( UUID . class ) , eq ( FactoryObjectProxy . class . getSimpleName ( ) ) , Mockito . anyString ( ) , Mockito . anyString ( ) ) ; inOrder . verify ( m_Callback ) . preObjectInitialize ( fInternal ) ; inOrder . verify ( m_ServiceProxy ) . initializeProxy ( eq ( fInternal ) , eq ( proxy ) , Mockito . anyMap ( ) ) ; inOrder . verify ( m_Callback ) . postObjectInitialize ( fInternal ) ; }
Verify if no name is passed in that an object is created with the name being the
 name of the proxy class.
Verify if no name is passed in that an object is created with the name being the name of the proxy class .