mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/asset/TestAssetModel.java
@Test
    public void testCapabilitiesSupportCommandsNull()
    {
        AssetFactoryModel afm = mock(AssetFactoryModel.class);
        when(afm.getFactoryCaps()).thenReturn(null);
        when(m_AssetTypesMgr.getAssetFactoryForClassAsync(anyInt(), anyString())).thenReturn(afm);
        
        AssetCapabilities ac = mock(AssetCapabilities.class);
        when(afm.getFactoryCaps()).thenReturn(ac);
        
        //create asset model and mocked objects
        AssetModel model = new AssetModel(123, m_Uuid, ASSET_PID, Asset.class.getName(), 
                m_FactoryMgr, m_ConfigWrapper, m_AssetTypesMgr, m_AssetImageInterface);
        AssetFactoryModel factoryModel = mock(AssetFactoryModel.class);
        AssetCapabilities assetCapabils = mock(AssetCapabilities.class);
        
        when(m_AssetTypesMgr.getAssetFactoryForClassAsync(123, Asset.class.getName())).thenReturn(factoryModel);
        when(factoryModel.getFactoryCaps()).thenReturn(assetCapabils);
        
        assertThat(model.isDataCaptureSupportAsync(), is(false));
        assertThat(model.isBitSupportAsync(), is(false));
        assertThat(model.isReadableAsync(), is(false));
        assertThat(model.isEditableAsync(), is(false));
    }
/**
     * Verify that the capabilities are returned as false when commands are returned as null.
     */
Verify that the capabilities are returned as false when commands are returned as null.
Verify that the capabilities are returned as false when commands are returned as null .
@Test
    public void testCapabilitiesSupportCommandsNull()
    {
        AssetFactoryModel afm = mock(AssetFactoryModel.class);
        when(afm.getFactoryCaps()).thenReturn(null);
        when(m_AssetTypesMgr.getAssetFactoryForClassAsync(anyInt(), anyString())).thenReturn(afm);
        AssetCapabilities ac = mock(AssetCapabilities.class);
        when(afm.getFactoryCaps()).thenReturn(ac);
        AssetModel model = new AssetModel(123, m_Uuid, ASSET_PID, Asset.class.getName(), 
                m_FactoryMgr, m_ConfigWrapper, m_AssetTypesMgr, m_AssetImageInterface);
        AssetFactoryModel factoryModel = mock(AssetFactoryModel.class);
        AssetCapabilities assetCapabils = mock(AssetCapabilities.class);
        when(m_AssetTypesMgr.getAssetFactoryForClassAsync(123, Asset.class.getName())).thenReturn(factoryModel);
        when(factoryModel.getFactoryCaps()).thenReturn(assetCapabils);
        assertThat(model.isDataCaptureSupportAsync(), is(false));
        assertThat(model.isBitSupportAsync(), is(false));
        assertThat(model.isReadableAsync(), is(false));
        assertThat(model.isEditableAsync(), is(false));
    }
@ Test public void testCapabilitiesSupportCommandsNull ( ) { AssetFactoryModel afm = mock ( AssetFactoryModel . class ) ; when ( afm . getFactoryCaps ( ) ) . thenReturn ( null ) ; when ( m_AssetTypesMgr . getAssetFactoryForClassAsync ( anyInt ( ) , anyString ( ) ) ) . thenReturn ( afm ) ; AssetCapabilities ac = mock ( AssetCapabilities . class ) ; when ( afm . getFactoryCaps ( ) ) . thenReturn ( ac ) ; AssetModel model = new AssetModel ( 123 , m_Uuid , ASSET_PID , Asset . class . getName ( ) , m_FactoryMgr , m_ConfigWrapper , m_AssetTypesMgr , m_AssetImageInterface ) ; AssetFactoryModel factoryModel = mock ( AssetFactoryModel . class ) ; AssetCapabilities assetCapabils = mock ( AssetCapabilities . class ) ; when ( m_AssetTypesMgr . getAssetFactoryForClassAsync ( 123 , Asset . class . getName ( ) ) ) . thenReturn ( factoryModel ) ; when ( factoryModel . getFactoryCaps ( ) ) . thenReturn ( assetCapabils ) ; assertThat ( model . isDataCaptureSupportAsync ( ) , is ( false ) ) ; assertThat ( model . isBitSupportAsync ( ) , is ( false ) ) ; assertThat ( model . isReadableAsync ( ) , is ( false ) ) ; assertThat ( model . isEditableAsync ( ) , is ( false ) ) ; }
Verify that the capabilities are returned as false when commands are returned as null.
Verify that the capabilities are returned as false when commands are returned as null .
//create asset model and mocked objects