mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/asset/TestAssetMgrImpl.java
@Test
    public void testHandlePerformBitResponse_InvalidFormat() 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 bitUpdate = mockPerformBITResponse_XmlFormat(systemId1);

        //handle event
        m_AssetHelper.handleEvent(bitUpdate);

        List<AssetModel> models = m_SUT.getAssetsForControllerAsync(systemId1);
        
        //verify that the asset with uuid1 is updated with appropriate status
        boolean verified = false;
        for (AssetModel model : models)
        {
            if (model.getUuid().equals(uuid1))
            {
                assertThat(model.getPid(), is(pid1));
                assertThat(model.getSummaryStatus(), is(nullValue()));
                assertThat(model.getSummaryDescription(), is(""));
                verified = true;
            }
        }
        
        //verify both assets were checked
        assertThat(verified, is(true));
    }
/**
     * Verify an invalid status observation format is ignored and doesn't cause an exception
     */
Verify an invalid status observation format is ignored and doesn't cause an exception
Verify an invalid status observation format is ignored and doesn ' t cause an exception
@Test
    public void testHandlePerformBitResponse_InvalidFormat() throws ObjectConverterException
    {
        Event getAssetsReponse = mockGetAssetsResponse(systemId1);
        m_AssetDirHelper.handleEvent(getAssetsReponse);
        assertThat(m_SUT.getAssetsForControllerAsync(systemId1).size(), is(2));
        Event bitUpdate = mockPerformBITResponse_XmlFormat(systemId1);
        m_AssetHelper.handleEvent(bitUpdate);
        List<AssetModel> models = m_SUT.getAssetsForControllerAsync(systemId1);
        boolean verified = false;
        for (AssetModel model : models)
        {
            if (model.getUuid().equals(uuid1))
            {
                assertThat(model.getPid(), is(pid1));
                assertThat(model.getSummaryStatus(), is(nullValue()));
                assertThat(model.getSummaryDescription(), is(""));
                verified = true;
            }
        }
        assertThat(verified, is(true));
    }
@ Test public void testHandlePerformBitResponse_InvalidFormat ( ) throws ObjectConverterException { Event getAssetsReponse = mockGetAssetsResponse ( systemId1 ) ; m_AssetDirHelper . handleEvent ( getAssetsReponse ) ; assertThat ( m_SUT . getAssetsForControllerAsync ( systemId1 ) . size ( ) , is ( 2 ) ) ; Event bitUpdate = mockPerformBITResponse_XmlFormat ( systemId1 ) ; m_AssetHelper . handleEvent ( bitUpdate ) ; List < AssetModel > models = m_SUT . getAssetsForControllerAsync ( systemId1 ) ; boolean verified = false ; for ( AssetModel model : models ) { if ( model . getUuid ( ) . equals ( uuid1 ) ) { assertThat ( model . getPid ( ) , is ( pid1 ) ) ; assertThat ( model . getSummaryStatus ( ) , is ( nullValue ( ) ) ) ; assertThat ( model . getSummaryDescription ( ) , is ( "" ) ) ; verified = true ; } } assertThat ( verified , is ( true ) ) ; }
Verify an invalid status observation format is ignored and doesn't cause an exception
Verify an invalid status observation format is ignored and doesn ' t cause an exception
//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 that the asset with uuid1 is updated with appropriate status //verify both assets were checked