mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/asset/TestScannerManager.java
@Test
    public void testScanException() throws InterruptedException
    {
        m_SUT.setAssetScanner(new ScannerStubException());

        EventAdminSyncer syncer = new EventAdminSyncer(m_EventAdmin, 
                AssetDirectoryService.TOPIC_SCANNING_FOR_ASSETS_COMPLETE, 2);
        m_SUT.scanForAssetsByType(m_ADS, AssetTypeException.class.getName());
        
        verify(m_WakeLock).activate();

        syncer.waitFor(16, TimeUnit.SECONDS);
        
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin, atLeastOnce()).postEvent(eventCaptor.capture());

        EventAdminVerifier.assertEventByTopicAssetType(eventCaptor, AssetDirectoryService.TOPIC_SCANNING_FOR_ASSETS, 
                AssetTypeException.class.getName());

        // should get null to signify all have completed
        EventAdminVerifier.assertEventByTopicNoAssetType(eventCaptor, 
                AssetDirectoryService.TOPIC_SCANNING_FOR_ASSETS_COMPLETE);

        Thread.sleep(1000);
        verify(m_WakeLock).cancel();
    }
/**
     * Verify the handling of a scanner that exceeds the 10 second limit.
     */
Verify the handling of a scanner that exceeds the 10 second limit.
Verify the handling of a scanner that exceeds the 10 second limit .
@Test
    public void testScanException() throws InterruptedException
    {
        m_SUT.setAssetScanner(new ScannerStubException());
        EventAdminSyncer syncer = new EventAdminSyncer(m_EventAdmin, 
                AssetDirectoryService.TOPIC_SCANNING_FOR_ASSETS_COMPLETE, 2);
        m_SUT.scanForAssetsByType(m_ADS, AssetTypeException.class.getName());
        verify(m_WakeLock).activate();
        syncer.waitFor(16, TimeUnit.SECONDS);
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin, atLeastOnce()).postEvent(eventCaptor.capture());
        EventAdminVerifier.assertEventByTopicAssetType(eventCaptor, AssetDirectoryService.TOPIC_SCANNING_FOR_ASSETS, 
                AssetTypeException.class.getName());
        EventAdminVerifier.assertEventByTopicNoAssetType(eventCaptor, 
                AssetDirectoryService.TOPIC_SCANNING_FOR_ASSETS_COMPLETE);
        Thread.sleep(1000);
        verify(m_WakeLock).cancel();
    }
@ Test public void testScanException ( ) throws InterruptedException { m_SUT . setAssetScanner ( new ScannerStubException ( ) ) ; EventAdminSyncer syncer = new EventAdminSyncer ( m_EventAdmin , AssetDirectoryService . TOPIC_SCANNING_FOR_ASSETS_COMPLETE , 2 ) ; m_SUT . scanForAssetsByType ( m_ADS , AssetTypeException . class . getName ( ) ) ; verify ( m_WakeLock ) . activate ( ) ; syncer . waitFor ( 16 , TimeUnit . SECONDS ) ; ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin , atLeastOnce ( ) ) . postEvent ( eventCaptor . capture ( ) ) ; EventAdminVerifier . assertEventByTopicAssetType ( eventCaptor , AssetDirectoryService . TOPIC_SCANNING_FOR_ASSETS , AssetTypeException . class . getName ( ) ) ; EventAdminVerifier . assertEventByTopicNoAssetType ( eventCaptor , AssetDirectoryService . TOPIC_SCANNING_FOR_ASSETS_COMPLETE ) ; Thread . sleep ( 1000 ) ; verify ( m_WakeLock ) . cancel ( ) ; }
Verify the handling of a scanner that exceeds the 10 second limit.
Verify the handling of a scanner that exceeds the 10 second limit .
// should get null to signify all have completed