mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/asset/TestAssetMgrImpl.java
@Test
    public void testHandleObjectNameUpdatedNull()
    {
        //load assets for one system
        Event getAssetsReponse = mockGetAssetsResponse(systemId1);

        //this should render two assets for the system id
        m_AssetDirHelper.handleEvent(getAssetsReponse);

        //get the default name
        List<AssetModel> models = m_SUT.getAssetsForControllerAsync(systemId1);
        
        //should be two models, the model with UUID2 is the model updated
        assertThat(models.size(), is(2));
        String defaultName;
        if (models.get(0).getUuid().equals(uuid2))
        {
            defaultName = models.get(0).getName();
        }
        else
        {
            defaultName = models.get(1).getName();
        }
        
        //handle updated event
        Event objUpdated = mockEventObjectNameUpdatedNull(systemId1);
        
        //this should create a request for updating information
        m_EventHelper.handleEvent(objUpdated);

        //get the asset model that should of been updated
        models = m_SUT.getAssetsForControllerAsync(systemId1);
        
        //should be two models
        assertThat(models.size(), is(2));
        AssetModel model;
        if (models.get(0).getUuid().equals(uuid2))
        {
            model = models.get(0);
        }
        else
        {
            model = models.get(1);
        }
        
        //name should still be the original name
        assertThat(model.getName(), is(defaultName));
    }
/**
     * Test the handling of object name updated event, where the actual name property is missing.
     * Verify that name is NOT updated.
     */
Test the handling of object name updated event, where the actual name property is missing.
Verify that name is NOT updated.
Test the handling of object name updated event where the actual name property is missing . Verify that name is NOT updated .
@Test
    public void testHandleObjectNameUpdatedNull()
    {
        Event getAssetsReponse = mockGetAssetsResponse(systemId1);
        m_AssetDirHelper.handleEvent(getAssetsReponse);
        List<AssetModel> models = m_SUT.getAssetsForControllerAsync(systemId1);
        assertThat(models.size(), is(2));
        String defaultName;
        if (models.get(0).getUuid().equals(uuid2))
        {
            defaultName = models.get(0).getName();
        }
        else
        {
            defaultName = models.get(1).getName();
        }
        Event objUpdated = mockEventObjectNameUpdatedNull(systemId1);
        m_EventHelper.handleEvent(objUpdated);
        models = m_SUT.getAssetsForControllerAsync(systemId1);
        assertThat(models.size(), is(2));
        AssetModel model;
        if (models.get(0).getUuid().equals(uuid2))
        {
            model = models.get(0);
        }
        else
        {
            model = models.get(1);
        }
        assertThat(model.getName(), is(defaultName));
    }
@ Test public void testHandleObjectNameUpdatedNull ( ) { Event getAssetsReponse = mockGetAssetsResponse ( systemId1 ) ; m_AssetDirHelper . handleEvent ( getAssetsReponse ) ; List < AssetModel > models = m_SUT . getAssetsForControllerAsync ( systemId1 ) ; assertThat ( models . size ( ) , is ( 2 ) ) ; String defaultName ; if ( models . get ( 0 ) . getUuid ( ) . equals ( uuid2 ) ) { defaultName = models . get ( 0 ) . getName ( ) ; } else { defaultName = models . get ( 1 ) . getName ( ) ; } Event objUpdated = mockEventObjectNameUpdatedNull ( systemId1 ) ; m_EventHelper . handleEvent ( objUpdated ) ; models = m_SUT . getAssetsForControllerAsync ( systemId1 ) ; assertThat ( models . size ( ) , is ( 2 ) ) ; AssetModel model ; if ( models . get ( 0 ) . getUuid ( ) . equals ( uuid2 ) ) { model = models . get ( 0 ) ; } else { model = models . get ( 1 ) ; } assertThat ( model . getName ( ) , is ( defaultName ) ) ; }
Test the handling of object name updated event, where the actual name property is missing.
Test the handling of object name updated event where the actual name property is missing .
//load assets for one system //this should render two assets for the system id //get the default name //should be two models, the model with UUID2 is the model updated //handle updated event //this should create a request for updating information //get the asset model that should of been updated //should be two models //name should still be the original name