mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/advanced/configuration/TestSystemConfigurationImpl.java
@SuppressWarnings("unchecked")
    @Test
    public void testCleanup() throws SecurityException, NoSuchFieldException, IllegalArgumentException, 
        IllegalAccessException
    {
        //Gain access to the map that stored event registration IDs so that fake ones can be added.
        Field map = m_SUT.getClass().getDeclaredField("m_EventRegistraionIds");
        map.setAccessible(true);
        Map<Integer, Integer> registrationIds = (Map<Integer, Integer>)map.get(m_SUT);
        
        //Add registered events to the registration map.
        registrationIds.put(25, 1);
        registrationIds.put(50, 30);
        registrationIds.put(7, 125);
        
        //Replay
        m_SUT.cleanup();
        
        //Verify that three handlers are unregistered.
        verify(m_HandlerReg, times(3)).unregister();
        
        ArgumentCaptor<UnregisterEventRequestData> messageCaptor = 
                ArgumentCaptor.forClass(UnregisterEventRequestData.class);
        
        //Verify that three unregister event messages are sent.
        verify(m_MessageFactory, times(3)).createEventAdminMessage(eq(EventAdminMessageType.UnregisterEventRequest), 
                messageCaptor.capture());
        verify(m_MessageWrapper).queue(eq(25), eq((ResponseHandler)null));
        verify(m_MessageWrapper).queue(eq(50), eq((ResponseHandler)null));
        verify(m_MessageWrapper).queue(eq(7), eq((ResponseHandler)null));
        
        //Verify the contents of the unregister event messages.
        UnregisterEventRequestData message = messageCaptor.getAllValues().get(0);
        assertThat(message.getId(), is(30));
        message = messageCaptor.getAllValues().get(1);
        assertThat(message.getId(), is(125));
        message = messageCaptor.getAllValues().get(2);
        assertThat(message.getId(), is(1));
    }
/**
     * Test the cleanup method.
     * Verify that all listeners are unregistered.
     * Verify that any unregister message is sent for all remote events being listened for.
     */
Test the cleanup method.
Verify that all listeners are unregistered.
Verify that any unregister message is sent for all remote events being listened for.
Test the cleanup method . Verify that all listeners are unregistered . Verify that any unregister message is sent for all remote events being listened for .
@SuppressWarnings("unchecked")
    @Test
    public void testCleanup() throws SecurityException, NoSuchFieldException, IllegalArgumentException, 
        IllegalAccessException
    {
        Field map = m_SUT.getClass().getDeclaredField("m_EventRegistraionIds");
        map.setAccessible(true);
        Map<Integer, Integer> registrationIds = (Map<Integer, Integer>)map.get(m_SUT);
        registrationIds.put(25, 1);
        registrationIds.put(50, 30);
        registrationIds.put(7, 125);
        m_SUT.cleanup();
        verify(m_HandlerReg, times(3)).unregister();
        ArgumentCaptor<UnregisterEventRequestData> messageCaptor = 
                ArgumentCaptor.forClass(UnregisterEventRequestData.class);
        verify(m_MessageFactory, times(3)).createEventAdminMessage(eq(EventAdminMessageType.UnregisterEventRequest), 
                messageCaptor.capture());
        verify(m_MessageWrapper).queue(eq(25), eq((ResponseHandler)null));
        verify(m_MessageWrapper).queue(eq(50), eq((ResponseHandler)null));
        verify(m_MessageWrapper).queue(eq(7), eq((ResponseHandler)null));
        UnregisterEventRequestData message = messageCaptor.getAllValues().get(0);
        assertThat(message.getId(), is(30));
        message = messageCaptor.getAllValues().get(1);
        assertThat(message.getId(), is(125));
        message = messageCaptor.getAllValues().get(2);
        assertThat(message.getId(), is(1));
    }
@ SuppressWarnings ( "unchecked" ) @ Test public void testCleanup ( ) throws SecurityException , NoSuchFieldException , IllegalArgumentException , IllegalAccessException { Field map = m_SUT . getClass ( ) . getDeclaredField ( "m_EventRegistraionIds" ) ; map . setAccessible ( true ) ; Map < Integer , Integer > registrationIds = ( Map < Integer , Integer > ) map . get ( m_SUT ) ; registrationIds . put ( 25 , 1 ) ; registrationIds . put ( 50 , 30 ) ; registrationIds . put ( 7 , 125 ) ; m_SUT . cleanup ( ) ; verify ( m_HandlerReg , times ( 3 ) ) . unregister ( ) ; ArgumentCaptor < UnregisterEventRequestData > messageCaptor = ArgumentCaptor . forClass ( UnregisterEventRequestData . class ) ; verify ( m_MessageFactory , times ( 3 ) ) . createEventAdminMessage ( eq ( EventAdminMessageType . UnregisterEventRequest ) , messageCaptor . capture ( ) ) ; verify ( m_MessageWrapper ) . queue ( eq ( 25 ) , eq ( ( ResponseHandler ) null ) ) ; verify ( m_MessageWrapper ) . queue ( eq ( 50 ) , eq ( ( ResponseHandler ) null ) ) ; verify ( m_MessageWrapper ) . queue ( eq ( 7 ) , eq ( ( ResponseHandler ) null ) ) ; UnregisterEventRequestData message = messageCaptor . getAllValues ( ) . get ( 0 ) ; assertThat ( message . getId ( ) , is ( 30 ) ) ; message = messageCaptor . getAllValues ( ) . get ( 1 ) ; assertThat ( message . getId ( ) , is ( 125 ) ) ; message = messageCaptor . getAllValues ( ) . get ( 2 ) ; assertThat ( message . getId ( ) , is ( 1 ) ) ; }
Test the cleanup method.
Test the cleanup method .
//Gain access to the map that stored event registration IDs so that fake ones can be added. //Add registered events to the registration map. //Replay //Verify that three handlers are unregistered. //Verify that three unregister event messages are sent. //Verify the contents of the unregister event messages.