mil.dod.th.ose.core/test/mil/dod/th/ose/core/factory/api/data/TestBaseFactoryObjectDataManager.java
@Test
    public void testGetPersistentUuid()
    {
        UUID uuid1 = UUID.randomUUID();
        UUID uuid2 = UUID.randomUUID();
        UUID uuid3 = UUID.randomUUID();
     
        //create data entries
        FactoryObjectData factData1 = createFactoryObjectData("bob", null);
        FactoryObjectData factData2 = createFactoryObjectData("jack", null);
        FactoryObjectData badData = FactoryObjectData.newBuilder().setName("pole").build();
        badData = FactoryObjectData.newBuilder().buildPartial();
        
        //create Persistent Data
        PersistentData pdata1 = createPersistentData(uuid1, factData1.toByteArray());
        PersistentData pdata2 = createPersistentData(uuid2, factData2.toByteArray());
        PersistentData pdata3 = createPersistentData(uuid3, badData.toByteArray());
        
        List<PersistentData> persistentDatas = new ArrayList<PersistentData>();
        persistentDatas.add(pdata1);
        persistentDatas.add(pdata2);
        persistentDatas.add(pdata3);
        
        when(m_PersistentDataStore.query(eq(LinkLayer.class))).thenReturn(persistentDatas);
        
        //find entity
        UUID foundUUID = m_SUT.getPersistentUuid("bob");
        
        assertThat(foundUUID, is(uuid1));       
    }
/**
     * Verify that getPersistentUuid can find and return the UUID based on the given name.
     * - the UUID associated with the given name should be returned
     * - data that cannot be parsed should be ignored
     */
Verify that getPersistentUuid can find and return the UUID based on the given name.
- the UUID associated with the given name should be returned
- data that cannot be parsed should be ignored
Verify that getPersistentUuid can find and return the UUID based on the given name . - the UUID associated with the given name should be returned - data that cannot be parsed should be ignored
@Test
    public void testGetPersistentUuid()
    {
        UUID uuid1 = UUID.randomUUID();
        UUID uuid2 = UUID.randomUUID();
        UUID uuid3 = UUID.randomUUID();
        FactoryObjectData factData1 = createFactoryObjectData("bob", null);
        FactoryObjectData factData2 = createFactoryObjectData("jack", null);
        FactoryObjectData badData = FactoryObjectData.newBuilder().setName("pole").build();
        badData = FactoryObjectData.newBuilder().buildPartial();
        PersistentData pdata1 = createPersistentData(uuid1, factData1.toByteArray());
        PersistentData pdata2 = createPersistentData(uuid2, factData2.toByteArray());
        PersistentData pdata3 = createPersistentData(uuid3, badData.toByteArray());
        List<PersistentData> persistentDatas = new ArrayList<PersistentData>();
        persistentDatas.add(pdata1);
        persistentDatas.add(pdata2);
        persistentDatas.add(pdata3);
        when(m_PersistentDataStore.query(eq(LinkLayer.class))).thenReturn(persistentDatas);
        UUID foundUUID = m_SUT.getPersistentUuid("bob");
        assertThat(foundUUID, is(uuid1));       
    }
@ Test public void testGetPersistentUuid ( ) { UUID uuid1 = UUID . randomUUID ( ) ; UUID uuid2 = UUID . randomUUID ( ) ; UUID uuid3 = UUID . randomUUID ( ) ; FactoryObjectData factData1 = createFactoryObjectData ( "bob" , null ) ; FactoryObjectData factData2 = createFactoryObjectData ( "jack" , null ) ; FactoryObjectData badData = FactoryObjectData . newBuilder ( ) . setName ( "pole" ) . build ( ) ; badData = FactoryObjectData . newBuilder ( ) . buildPartial ( ) ; PersistentData pdata1 = createPersistentData ( uuid1 , factData1 . toByteArray ( ) ) ; PersistentData pdata2 = createPersistentData ( uuid2 , factData2 . toByteArray ( ) ) ; PersistentData pdata3 = createPersistentData ( uuid3 , badData . toByteArray ( ) ) ; List < PersistentData > persistentDatas = new ArrayList < PersistentData > ( ) ; persistentDatas . add ( pdata1 ) ; persistentDatas . add ( pdata2 ) ; persistentDatas . add ( pdata3 ) ; when ( m_PersistentDataStore . query ( eq ( LinkLayer . class ) ) ) . thenReturn ( persistentDatas ) ; UUID foundUUID = m_SUT . getPersistentUuid ( "bob" ) ; assertThat ( foundUUID , is ( uuid1 ) ) ; }
Verify that getPersistentUuid can find and return the UUID based on the given name.
Verify that getPersistentUuid can find and return the UUID based on the given name .
//create data entries //create Persistent Data //find entity