mil.dod.th.ose.core/test/mil/dod/th/ose/core/factory/api/data/TestBaseFactoryObjectDataManager.java
@Test
    public void testSetName() throws FactoryObjectInformationException, IllegalArgumentException, 
        PersistenceFailedException, InvalidProtocolBufferException, ValidationFailedException
    {
        //the name to use
        String name = "new";
        //the uuid
        UUID uuid = UUID.randomUUID();

        //m_FactData = FactoryObjectData.newBuilder().setName("original").build();
        FactoryObjectData factData = createFactoryObjectData("original", null);
        
        PersistentData persistentData = createPersistentData(uuid, factData.toByteArray());

        //call to set a name
        m_SUT.setName(uuid, name);
        
        //verify
        verify(m_PersistentDataStore).merge(persistentData);
        
        //capture what was set
        ArgumentCaptor<Serializable> messageCap = ArgumentCaptor.forClass(Serializable.class);
        verify(persistentData).setEntity(messageCap.capture());
        
        FactoryObjectData mergedData = FactoryObjectData.parseFrom((byte[])messageCap.getValue());
        assertThat(mergedData.getName(), is(name));
    }
/**
     * Verify the behavior of set name if the factory object data exists.
     * - Updated data with the new name should be merged into the data store for the given UUID entry
     */
Verify the behavior of set name if the factory object data exists.
- Updated data with the new name should be merged into the data store for the given UUID entry
Verify the behavior of set name if the factory object data exists . - Updated data with the new name should be merged into the data store for the given UUID entry
@Test
    public void testSetName() throws FactoryObjectInformationException, IllegalArgumentException, 
        PersistenceFailedException, InvalidProtocolBufferException, ValidationFailedException
    {
        String name = "new";
        UUID uuid = UUID.randomUUID();
        FactoryObjectData factData = createFactoryObjectData("original", null);
        PersistentData persistentData = createPersistentData(uuid, factData.toByteArray());
        m_SUT.setName(uuid, name);
        verify(m_PersistentDataStore).merge(persistentData);
        ArgumentCaptor<Serializable> messageCap = ArgumentCaptor.forClass(Serializable.class);
        verify(persistentData).setEntity(messageCap.capture());
        FactoryObjectData mergedData = FactoryObjectData.parseFrom((byte[])messageCap.getValue());
        assertThat(mergedData.getName(), is(name));
    }
@ Test public void testSetName ( ) throws FactoryObjectInformationException , IllegalArgumentException , PersistenceFailedException , InvalidProtocolBufferException , ValidationFailedException { String name = "new" ; UUID uuid = UUID . randomUUID ( ) ; FactoryObjectData factData = createFactoryObjectData ( "original" , null ) ; PersistentData persistentData = createPersistentData ( uuid , factData . toByteArray ( ) ) ; m_SUT . setName ( uuid , name ) ; verify ( m_PersistentDataStore ) . merge ( persistentData ) ; ArgumentCaptor < Serializable > messageCap = ArgumentCaptor . forClass ( Serializable . class ) ; verify ( persistentData ) . setEntity ( messageCap . capture ( ) ) ; FactoryObjectData mergedData = FactoryObjectData . parseFrom ( ( byte [ ] ) messageCap . getValue ( ) ) ; assertThat ( mergedData . getName ( ) , is ( name ) ) ; }
Verify the behavior of set name if the factory object data exists.
Verify the behavior of set name if the factory object data exists .
//the name to use //the uuid //m_FactData = FactoryObjectData.newBuilder().setName("original").build(); //call to set a name //verify //capture what was set