mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/asset/TestAssetMgrImpl.java
@Test
    public void testHandleGetLastStatusResponseUnknownAsset() throws ObjectConverterException
    {
        //make some assets
        Event getAssetsReponse = mockGetAssetsResponse(systemId1);
        
        //this should render two assets for the system id
        m_AssetDirHelper.handleEvent(getAssetsReponse);

        //verify assets added
        assertThat(m_SUT.getAssetsForControllerAsync(systemId1).size(), is(2));

        //create asset appropriate event for the asset status update
        Event getStatusResponse = mockGetStatusResponseDiffUuid(systemId1);

        //handle event
        m_AssetHelper.handleEvent(getStatusResponse);

        //verify
        List<AssetModel> models = m_SUT.getAssetsForControllerAsync(systemId1);
        
        //verify that neither asset's status is updated
        boolean verifiedAsset1 = false;
        boolean verifiedAsset2 = false;
        for (AssetModel model : models)
        {
            if (model.getUuid().equals(uuid1))
            {
                assertThat(model.getPid(), is(pid1));
                assertThat(model.getSummaryStatus(), is(nullValue()));
                verifiedAsset1 = true;
            }
            //check that other the other asset's status wasn't updated either
            else
            {
                assertThat(model.getUuid(), is(uuid2));
                assertThat(model.getPid(), is(pid2));
                assertThat(model.getSummaryStatus(), is(nullValue()));
                verifiedAsset2 = true;
            }
        }
        
        //verify both assets were checked
        assertThat(verifiedAsset1, is(true));
        assertThat(verifiedAsset2, is(true));
        
        verify(m_EventAdmin, never()).postEvent(Mockito.any(Event.class));
    }
/**
     * Test the handling of get status request event when the asset that the status is about isn't known.
     */
Test the handling of get status request event when the asset that the status is about isn't known.
Test the handling of get status request event when the asset that the status is about isn ' t known .
@Test
    public void testHandleGetLastStatusResponseUnknownAsset() throws ObjectConverterException
    {
        Event getAssetsReponse = mockGetAssetsResponse(systemId1);
        m_AssetDirHelper.handleEvent(getAssetsReponse);
        assertThat(m_SUT.getAssetsForControllerAsync(systemId1).size(), is(2));
        Event getStatusResponse = mockGetStatusResponseDiffUuid(systemId1);
        m_AssetHelper.handleEvent(getStatusResponse);
        List<AssetModel> models = m_SUT.getAssetsForControllerAsync(systemId1);
         that neither asset's status is updated
        boolean verifiedAsset1 = false;
        boolean verifiedAsset2 = false;
        for (AssetModel model : models)
        {
            if (model.getUuid().equals(uuid1))
            {
                assertThat(model.getPid(), is(pid1));
                assertThat(model.getSummaryStatus(), is(nullValue()));
                verifiedAsset1 = true;
            }
            else
            {
                assertThat(model.getUuid(), is(uuid2));
                assertThat(model.getPid(), is(pid2));
                assertThat(model.getSummaryStatus(), is(nullValue()));
                verifiedAsset2 = true;
            }
        }
         both assets were checked
        assertThat(verifiedAsset1, is(true));
        assertThat(verifiedAsset2, is(true));
        verify(m_EventAdmin, never()).postEvent(Mockito.any(Event.class));
    }
@ Test public void testHandleGetLastStatusResponseUnknownAsset ( ) throws ObjectConverterException { Event getAssetsReponse = mockGetAssetsResponse ( systemId1 ) ; m_AssetDirHelper . handleEvent ( getAssetsReponse ) ; assertThat ( m_SUT . getAssetsForControllerAsync ( systemId1 ) . size ( ) , is ( 2 ) ) ; Event getStatusResponse = mockGetStatusResponseDiffUuid ( systemId1 ) ; m_AssetHelper . handleEvent ( getStatusResponse ) ; List < AssetModel > models = m_SUT . getAssetsForControllerAsync ( systemId1 ) ; boolean verifiedAsset1 = false ; boolean verifiedAsset2 = false ; for ( AssetModel model : models ) { if ( model . getUuid ( ) . equals ( uuid1 ) ) { assertThat ( model . getPid ( ) , is ( pid1 ) ) ; assertThat ( model . getSummaryStatus ( ) , is ( nullValue ( ) ) ) ; verifiedAsset1 = true ; } else { assertThat ( model . getUuid ( ) , is ( uuid2 ) ) ; assertThat ( model . getPid ( ) , is ( pid2 ) ) ; assertThat ( model . getSummaryStatus ( ) , is ( nullValue ( ) ) ) ; verifiedAsset2 = true ; } } assertThat ( verifiedAsset1 , is ( true ) ) ; assertThat ( verifiedAsset2 , is ( true ) ) ; verify ( m_EventAdmin , never ( ) ) . postEvent ( Mockito . any ( Event . class ) ) ; }
Test the handling of get status request event when the asset that the status is about isn't known.
Test the handling of get status request event when the asset that the status is about isn ' t known .
//make some assets //this should render two assets for the system id //verify assets added //create asset appropriate event for the asset status update //handle event //verify //verify that neither asset's status is updated //check that other the other asset's status wasn't updated either //verify both assets were checked