mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/asset/TestAssetGetCommandMgrImpl.java
@SuppressWarnings({"unchecked", "rawtypes"})
    @Test
    public void testCleanUpAndReg()
    {
        ServiceRegistration handlerRegA = mock(ServiceRegistration.class);
        ServiceRegistration handlerRegB = mock(ServiceRegistration.class);
        ArgumentCaptor<Dictionary> dictionaryCap = ArgumentCaptor.forClass(Dictionary.class);
        when(m_BundleUtil.getBundleContext()).thenReturn(m_BundleContext);
        when(m_BundleContext.registerService(eq(EventHandler.class), Mockito.any(EventHandler.class), 
                dictionaryCap.capture())).thenReturn(handlerRegA, handlerRegB);
        
        m_SUT.postConstruct();
        assertThat(dictionaryCap.getAllValues().size(), is(2));
        Dictionary<String, Object> dict1 = dictionaryCap.getAllValues().get(0);
        Dictionary<String, Object> dict2 = dictionaryCap.getAllValues().get(1);
        
        assertThat((String)dict1.get(EventConstants.EVENT_TOPIC), 
                isOneOf(RemoteConstants.TOPIC_MESSAGE_RECEIVED, 
                        Asset.TOPIC_COMMAND_RESPONSE_UPDATED + RemoteConstants.REMOTE_TOPIC_SUFFIX));
        assertThat((String)dict2.get(EventConstants.EVENT_TOPIC), 
                isOneOf(RemoteConstants.TOPIC_MESSAGE_RECEIVED, 
                        Asset.TOPIC_COMMAND_RESPONSE_UPDATED + RemoteConstants.REMOTE_TOPIC_SUFFIX));
        m_SUT.cleanup();
        
        //verify
        verify(handlerRegA).unregister();
        verify(handlerRegB).unregister();
    }
/**
     * Test that cleanup will actually deregister the event handlers.
     */
Test that cleanup will actually deregister the event handlers.
Test that cleanup will actually deregister the event handlers .
@SuppressWarnings({"unchecked", "rawtypes"})
    @Test
    public void testCleanUpAndReg()
    {
        ServiceRegistration handlerRegA = mock(ServiceRegistration.class);
        ServiceRegistration handlerRegB = mock(ServiceRegistration.class);
        ArgumentCaptor<Dictionary> dictionaryCap = ArgumentCaptor.forClass(Dictionary.class);
        when(m_BundleUtil.getBundleContext()).thenReturn(m_BundleContext);
        when(m_BundleContext.registerService(eq(EventHandler.class), Mockito.any(EventHandler.class), 
                dictionaryCap.capture())).thenReturn(handlerRegA, handlerRegB);
        m_SUT.postConstruct();
        assertThat(dictionaryCap.getAllValues().size(), is(2));
        Dictionary<String, Object> dict1 = dictionaryCap.getAllValues().get(0);
        Dictionary<String, Object> dict2 = dictionaryCap.getAllValues().get(1);
        assertThat((String)dict1.get(EventConstants.EVENT_TOPIC), 
                isOneOf(RemoteConstants.TOPIC_MESSAGE_RECEIVED, 
                        Asset.TOPIC_COMMAND_RESPONSE_UPDATED + RemoteConstants.REMOTE_TOPIC_SUFFIX));
        assertThat((String)dict2.get(EventConstants.EVENT_TOPIC), 
                isOneOf(RemoteConstants.TOPIC_MESSAGE_RECEIVED, 
                        Asset.TOPIC_COMMAND_RESPONSE_UPDATED + RemoteConstants.REMOTE_TOPIC_SUFFIX));
        m_SUT.cleanup();
        verify(handlerRegA).unregister();
        verify(handlerRegB).unregister();
    }
@ SuppressWarnings ( { "unchecked" , "rawtypes" } ) @ Test public void testCleanUpAndReg ( ) { ServiceRegistration handlerRegA = mock ( ServiceRegistration . class ) ; ServiceRegistration handlerRegB = mock ( ServiceRegistration . class ) ; ArgumentCaptor < Dictionary > dictionaryCap = ArgumentCaptor . forClass ( Dictionary . class ) ; when ( m_BundleUtil . getBundleContext ( ) ) . thenReturn ( m_BundleContext ) ; when ( m_BundleContext . registerService ( eq ( EventHandler . class ) , Mockito . any ( EventHandler . class ) , dictionaryCap . capture ( ) ) ) . thenReturn ( handlerRegA , handlerRegB ) ; m_SUT . postConstruct ( ) ; assertThat ( dictionaryCap . getAllValues ( ) . size ( ) , is ( 2 ) ) ; Dictionary < String , Object > dict1 = dictionaryCap . getAllValues ( ) . get ( 0 ) ; Dictionary < String , Object > dict2 = dictionaryCap . getAllValues ( ) . get ( 1 ) ; assertThat ( ( String ) dict1 . get ( EventConstants . EVENT_TOPIC ) , isOneOf ( RemoteConstants . TOPIC_MESSAGE_RECEIVED , Asset . TOPIC_COMMAND_RESPONSE_UPDATED + RemoteConstants . REMOTE_TOPIC_SUFFIX ) ) ; assertThat ( ( String ) dict2 . get ( EventConstants . EVENT_TOPIC ) , isOneOf ( RemoteConstants . TOPIC_MESSAGE_RECEIVED , Asset . TOPIC_COMMAND_RESPONSE_UPDATED + RemoteConstants . REMOTE_TOPIC_SUFFIX ) ) ; m_SUT . cleanup ( ) ; verify ( handlerRegA ) . unregister ( ) ; verify ( handlerRegB ) . unregister ( ) ; }
Test that cleanup will actually deregister the event handlers.
Test that cleanup will actually deregister the event handlers .
//verify