mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/asset/TestAssetTypesMgrImpl.java
@Test
    public void testGetAssetFactoryForClassAsync()
    {
        //verify first time I get null and message is sent out
        AssetFactoryModel modelDNE = m_SUT.getAssetFactoryForClassAsync(systemId1, "no.matter.this.class.name");
        assertThat(modelDNE, nullValue());
        
        verify(m_MessageFactory).createAssetDirectoryServiceMessage(
                eq(AssetDirectoryServiceMessageType.GetAssetTypesRequest), (Message)eq(null));
        
        //load assets for system id
        Event getTypes = mockMessageGetAssetTypesResponse(systemId1);
        
        //this should render two asset types for the system id
        m_AssetHelper.handleEvent(getTypes);
        
        AssetFactoryModel foundModel = m_SUT.getAssetFactoryForClassAsync(systemId1, 
                "sometimes.youfeellikeanut.SometimesYouDont");
        
        assertThat(foundModel, notNullValue());
        assertThat(foundModel.getSimpleType(), is("SometimesYouDont"));
        
        modelDNE = m_SUT.getAssetFactoryForClassAsync(systemId1, "class.not.even.there");
        assertThat(modelDNE, is(nullValue()));
        
        // should still be holding at one, should not send another request even if not found
        verify(m_MessageFactory, times(1)).createAssetDirectoryServiceMessage(
                eq(AssetDirectoryServiceMessageType.GetAssetTypesRequest), (Message)eq(null));
    }
/**
     * Verify method returns factory model and sends info request.
     */
Verify method returns factory model and sends info request.
Verify method returns factory model and sends info request .
@Test
    public void testGetAssetFactoryForClassAsync()
    {
        AssetFactoryModel modelDNE = m_SUT.getAssetFactoryForClassAsync(systemId1, "no.matter.this.class.name");
        assertThat(modelDNE, nullValue());
        verify(m_MessageFactory).createAssetDirectoryServiceMessage(
                eq(AssetDirectoryServiceMessageType.GetAssetTypesRequest), (Message)eq(null));
        Event getTypes = mockMessageGetAssetTypesResponse(systemId1);
        m_AssetHelper.handleEvent(getTypes);
        AssetFactoryModel foundModel = m_SUT.getAssetFactoryForClassAsync(systemId1, 
                "sometimes.youfeellikeanut.SometimesYouDont");
        assertThat(foundModel, notNullValue());
        assertThat(foundModel.getSimpleType(), is("SometimesYouDont"));
        modelDNE = m_SUT.getAssetFactoryForClassAsync(systemId1, "class.not.even.there");
        assertThat(modelDNE, is(nullValue()));
        verify(m_MessageFactory, times(1)).createAssetDirectoryServiceMessage(
                eq(AssetDirectoryServiceMessageType.GetAssetTypesRequest), (Message)eq(null));
    }
@ Test public void testGetAssetFactoryForClassAsync ( ) { AssetFactoryModel modelDNE = m_SUT . getAssetFactoryForClassAsync ( systemId1 , "no.matter.this.class.name" ) ; assertThat ( modelDNE , nullValue ( ) ) ; verify ( m_MessageFactory ) . createAssetDirectoryServiceMessage ( eq ( AssetDirectoryServiceMessageType . GetAssetTypesRequest ) , ( Message ) eq ( null ) ) ; Event getTypes = mockMessageGetAssetTypesResponse ( systemId1 ) ; m_AssetHelper . handleEvent ( getTypes ) ; AssetFactoryModel foundModel = m_SUT . getAssetFactoryForClassAsync ( systemId1 , "sometimes.youfeellikeanut.SometimesYouDont" ) ; assertThat ( foundModel , notNullValue ( ) ) ; assertThat ( foundModel . getSimpleType ( ) , is ( "SometimesYouDont" ) ) ; modelDNE = m_SUT . getAssetFactoryForClassAsync ( systemId1 , "class.not.even.there" ) ; assertThat ( modelDNE , is ( nullValue ( ) ) ) ; verify ( m_MessageFactory , times ( 1 ) ) . createAssetDirectoryServiceMessage ( eq ( AssetDirectoryServiceMessageType . GetAssetTypesRequest ) , ( Message ) eq ( null ) ) ; }
Verify method returns factory model and sends info request.
Verify method returns factory model and sends info request .
//verify first time I get null and message is sent out //load assets for system id //this should render two asset types for the system id // should still be holding at one, should not send another request even if not found