mil.dod.th.ose.core/test/mil/dod/th/ose/core/factory/api/data/TestBaseFactoryObjectDataManager.java
@Test
    public void testClearPid() throws FactoryObjectInformationException, IllegalArgumentException,
        PersistenceFailedException, InvalidProtocolBufferException
    {
        //mock factory object persistent data entry
        UUID uuid = UUID.randomUUID();
        FactoryObjectData factData = createFactoryObjectData("name", "clearThisPid");
        PersistentData persistentData = createPersistentData(uuid, factData.toByteArray());
   
        //run the method, not expecting any exceptions
        m_SUT.clearPid(uuid);
        
        //verify that the persistent data entry is updated with a new version of the factoryObjectData
        //capture what was set
        ArgumentCaptor<Serializable> messageCap = ArgumentCaptor.forClass(Serializable.class);
        verify(persistentData).setEntity(messageCap.capture());
        
        //parse the updated data from the capture
        FactoryObjectData updatedFactData = FactoryObjectData.parseFrom((byte[])messageCap.getValue());
 
        //verify that the data has no Pid
        assertThat(updatedFactData.hasPid(), is(false));
    }
/**
     * Verify expected behavior of clearPid() if the data exists and has a PID value.
     * - PID entry in the entity of the PersistentData for the given object should be cleared
     */
Verify expected behavior of clearPid() if the data exists and has a PID value.
- PID entry in the entity of the PersistentData for the given object should be cleared
Verify expected behavior of clearPid () if the data exists and has a PID value . - PID entry in the entity of the PersistentData for the given object should be cleared
@Test
    public void testClearPid() throws FactoryObjectInformationException, IllegalArgumentException,
        PersistenceFailedException, InvalidProtocolBufferException
    {
        UUID uuid = UUID.randomUUID();
        FactoryObjectData factData = createFactoryObjectData("name", "clearThisPid");
        PersistentData persistentData = createPersistentData(uuid, factData.toByteArray());
        m_SUT.clearPid(uuid);
        ArgumentCaptor<Serializable> messageCap = ArgumentCaptor.forClass(Serializable.class);
        verify(persistentData).setEntity(messageCap.capture());
        FactoryObjectData updatedFactData = FactoryObjectData.parseFrom((byte[])messageCap.getValue());
        assertThat(updatedFactData.hasPid(), is(false));
    }
@ Test public void testClearPid ( ) throws FactoryObjectInformationException , IllegalArgumentException , PersistenceFailedException , InvalidProtocolBufferException { UUID uuid = UUID . randomUUID ( ) ; FactoryObjectData factData = createFactoryObjectData ( "name" , "clearThisPid" ) ; PersistentData persistentData = createPersistentData ( uuid , factData . toByteArray ( ) ) ; m_SUT . clearPid ( uuid ) ; ArgumentCaptor < Serializable > messageCap = ArgumentCaptor . forClass ( Serializable . class ) ; verify ( persistentData ) . setEntity ( messageCap . capture ( ) ) ; FactoryObjectData updatedFactData = FactoryObjectData . parseFrom ( ( byte [ ] ) messageCap . getValue ( ) ) ; assertThat ( updatedFactData . hasPid ( ) , is ( false ) ) ; }
Verify expected behavior of clearPid() if the data exists and has a PID value.
Verify expected behavior of clearPid () if the data exists and has a PID value .
//mock factory object persistent data entry //run the method, not expecting any exceptions //verify that the persistent data entry is updated with a new version of the factoryObjectData //capture what was set //parse the updated data from the capture //verify that the data has no Pid