mil.dod.th.ose.core/test/mil/dod/th/ose/core/factory/api/TestFactoryRegistry.java
@Test
    public void testRemoveObject() throws IllegalArgumentException, FactoryException, FactoryObjectInformationException
    {
        when(m_FactoryDescriptor.getProductType()).thenReturn("product type");
        FactoryObjectProxy factoryObjectProxy = mock(FactoryObjectProxy.class);
        ComponentInstance instance = mockComponentInstance(UUID.randomUUID(), "name", "samplepid");

        when(m_FactoryDescriptor.create()).thenReturn(factoryObjectProxy);
        when(m_ServiceProxy.createFactoryObjectInternal(m_FactoryDescriptor)).thenReturn(instance);

        Map<String, Object> properties = new HashMap<>();

        // replay
        FactoryObjectInternal createdObj = m_SUT.createNewObject(m_FactoryDescriptor, "samplepid", properties);
        m_SUT.removeObject(createdObj.getUuid());

        verify(m_Callback).onRemovedObject(createdObj);
    }
/**
     * Verify that a created object can be removed.
     */
Verify that a created object can be removed.
Verify that a created object can be removed .
@Test
    public void testRemoveObject() throws IllegalArgumentException, FactoryException, FactoryObjectInformationException
    {
        when(m_FactoryDescriptor.getProductType()).thenReturn("product type");
        FactoryObjectProxy factoryObjectProxy = mock(FactoryObjectProxy.class);
        ComponentInstance instance = mockComponentInstance(UUID.randomUUID(), "name", "samplepid");
        when(m_FactoryDescriptor.create()).thenReturn(factoryObjectProxy);
        when(m_ServiceProxy.createFactoryObjectInternal(m_FactoryDescriptor)).thenReturn(instance);
        Map<String, Object> properties = new HashMap<>();
        FactoryObjectInternal createdObj = m_SUT.createNewObject(m_FactoryDescriptor, "samplepid", properties);
        m_SUT.removeObject(createdObj.getUuid());
        verify(m_Callback).onRemovedObject(createdObj);
    }
@ Test public void testRemoveObject ( ) throws IllegalArgumentException , FactoryException , FactoryObjectInformationException { when ( m_FactoryDescriptor . getProductType ( ) ) . thenReturn ( "product type" ) ; FactoryObjectProxy factoryObjectProxy = mock ( FactoryObjectProxy . class ) ; ComponentInstance instance = mockComponentInstance ( UUID . randomUUID ( ) , "name" , "samplepid" ) ; when ( m_FactoryDescriptor . create ( ) ) . thenReturn ( factoryObjectProxy ) ; when ( m_ServiceProxy . createFactoryObjectInternal ( m_FactoryDescriptor ) ) . thenReturn ( instance ) ; Map < String , Object > properties = new HashMap < > ( ) ; FactoryObjectInternal createdObj = m_SUT . createNewObject ( m_FactoryDescriptor , "samplepid" , properties ) ; m_SUT . removeObject ( createdObj . getUuid ( ) ) ; verify ( m_Callback ) . onRemovedObject ( createdObj ) ; }
Verify that a created object can be removed.
Verify that a created object can be removed .
// replay