mil.dod.th.ose.config/test/mil/dod/th/ose/config/event/TestConfigurationAdminEventBridge.java
@SuppressWarnings("unchecked")
    @Test
    public void testActivate()
    { 
        BundleContext context = mock(BundleContext.class);

        //Mock the registration return from the bundle context.
        when(context.registerService(eq(ConfigurationListener.class), Mockito.any(ConfigListener.class), 
                Mockito.any(Dictionary.class))).thenReturn(m_ServiceRegistration);
        
        //Activate the class.
        m_SUT.activate(context);
        
        @SuppressWarnings("rawtypes")
        ArgumentCaptor<Dictionary> captor = ArgumentCaptor.forClass(Dictionary.class);
        ArgumentCaptor<ConfigListener> listenerCaptor = ArgumentCaptor.forClass(ConfigListener.class);
        //Verify that the bundle context register service method was called and capture the dictionary that
        //was passed to the registration method.
        verify(context).registerService(eq(ConfigurationListener.class), listenerCaptor.capture(), 
                captor.capture());
        
        Dictionary<String, Object> props = captor.getValue();
        m_ConfigListener = listenerCaptor.getValue();
        
        //Verify the contents of the dictionary passed the service registration method of the bundle context.
        assertThat(props.get(EventConstants.EVENT_TOPIC), is((Object)"org/osgi/service/cm/ConfigurationEvent/*"));
    }
/**
     * Test the activate method.
     * Verify that a configuration listener is registered with the bundle context.
     */
Test the activate method.
Verify that a configuration listener is registered with the bundle context.
Test the activate method . Verify that a configuration listener is registered with the bundle context .
@SuppressWarnings("unchecked")
    @Test
    public void testActivate()
    { 
        BundleContext context = mock(BundleContext.class);
        when(context.registerService(eq(ConfigurationListener.class), Mockito.any(ConfigListener.class), 
                Mockito.any(Dictionary.class))).thenReturn(m_ServiceRegistration);
        m_SUT.activate(context);
        @SuppressWarnings("rawtypes")
        ArgumentCaptor<Dictionary> captor = ArgumentCaptor.forClass(Dictionary.class);
        ArgumentCaptor<ConfigListener> listenerCaptor = ArgumentCaptor.forClass(ConfigListener.class);
        verify(context).registerService(eq(ConfigurationListener.class), listenerCaptor.capture(), 
                captor.capture());
        Dictionary<String, Object> props = captor.getValue();
        m_ConfigListener = listenerCaptor.getValue();
        assertThat(props.get(EventConstants.EVENT_TOPIC), is((Object)"org/osgi/service/cm/ConfigurationEvent/*"));
    }
@ SuppressWarnings ( "unchecked" ) @ Test public void testActivate ( ) { BundleContext context = mock ( BundleContext . class ) ; when ( context . registerService ( eq ( ConfigurationListener . class ) , Mockito . any ( ConfigListener . class ) , Mockito . any ( Dictionary . class ) ) ) . thenReturn ( m_ServiceRegistration ) ; m_SUT . activate ( context ) ; @ SuppressWarnings ( "rawtypes" ) ArgumentCaptor < Dictionary > captor = ArgumentCaptor . forClass ( Dictionary . class ) ; ArgumentCaptor < ConfigListener > listenerCaptor = ArgumentCaptor . forClass ( ConfigListener . class ) ; verify ( context ) . registerService ( eq ( ConfigurationListener . class ) , listenerCaptor . capture ( ) , captor . capture ( ) ) ; Dictionary < String , Object > props = captor . getValue ( ) ; m_ConfigListener = listenerCaptor . getValue ( ) ; assertThat ( props . get ( EventConstants . EVENT_TOPIC ) , is ( ( Object ) "org/osgi/service/cm/ConfigurationEvent/*" ) ) ; }
Test the activate method.
Test the activate method .
//Mock the registration return from the bundle context. //Activate the class. //Verify that the bundle context register service method was called and capture the dictionary that //was passed to the registration method. //Verify the contents of the dictionary passed the service registration method of the bundle context.