mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/factory/TestFactoryObjectDisplayHelperImpl.java
@Test
    public void testGetFactoryObjectList()
    {
        ControllerModel contModel = mock(ControllerModel.class);
        when(contModel.getId()).thenReturn(systemId);

        //create list of asset models
        List<AssetModel> assetModels = new ArrayList<AssetModel>();
        AssetModel model = mock(AssetModel.class);
        when(model.getUuid()).thenReturn(uuid);
        when(model.getControllerId()).thenReturn(systemId);
        AssetModel model2 = mock(AssetModel.class);
        when(model2.getUuid()).thenReturn(UUID.randomUUID());
        when(model2.getControllerId()).thenReturn(systemId);
        
        //add the models
        assetModels.add(model);
        assetModels.add(model2);

        //mock behavior for the asset manager
        when(m_AssetMgr.getAssetsForControllerAsync(systemId)).thenReturn(assetModels);
        when(m_ActiveController.getActiveController()).thenReturn(contModel);

        //verify, should be the two models created above
        assertThat((m_SUT.getFactoryObjectListAsync()).size(), is(2));
    }
/**
     * Test getting the factory objects to display for the asset service.
     */
Test getting the factory objects to display for the asset service.
Test getting the factory objects to display for the asset service .
@Test
    public void testGetFactoryObjectList()
    {
        ControllerModel contModel = mock(ControllerModel.class);
        when(contModel.getId()).thenReturn(systemId);
        List<AssetModel> assetModels = new ArrayList<AssetModel>();
        AssetModel model = mock(AssetModel.class);
        when(model.getUuid()).thenReturn(uuid);
        when(model.getControllerId()).thenReturn(systemId);
        AssetModel model2 = mock(AssetModel.class);
        when(model2.getUuid()).thenReturn(UUID.randomUUID());
        when(model2.getControllerId()).thenReturn(systemId);
        assetModels.add(model);
        assetModels.add(model2);
        when(m_AssetMgr.getAssetsForControllerAsync(systemId)).thenReturn(assetModels);
        when(m_ActiveController.getActiveController()).thenReturn(contModel);
        assertThat((m_SUT.getFactoryObjectListAsync()).size(), is(2));
    }
@ Test public void testGetFactoryObjectList ( ) { ControllerModel contModel = mock ( ControllerModel . class ) ; when ( contModel . getId ( ) ) . thenReturn ( systemId ) ; List < AssetModel > assetModels = new ArrayList < AssetModel > ( ) ; AssetModel model = mock ( AssetModel . class ) ; when ( model . getUuid ( ) ) . thenReturn ( uuid ) ; when ( model . getControllerId ( ) ) . thenReturn ( systemId ) ; AssetModel model2 = mock ( AssetModel . class ) ; when ( model2 . getUuid ( ) ) . thenReturn ( UUID . randomUUID ( ) ) ; when ( model2 . getControllerId ( ) ) . thenReturn ( systemId ) ; assetModels . add ( model ) ; assetModels . add ( model2 ) ; when ( m_AssetMgr . getAssetsForControllerAsync ( systemId ) ) . thenReturn ( assetModels ) ; when ( m_ActiveController . getActiveController ( ) ) . thenReturn ( contModel ) ; assertThat ( ( m_SUT . getFactoryObjectListAsync ( ) ) . size ( ) , is ( 2 ) ) ; }
Test getting the factory objects to display for the asset service.
Test getting the factory objects to display for the asset service .
//create list of asset models //add the models //mock behavior for the asset manager //verify, should be the two models created above