### Question:
ConsoleConfigHandlerImpl implements ConsoleConfigHandler { @Override public void registerListener(ConsoleConfigListener listener, Class<? extends ConsoleConfigBuilder<?>> builderType) { ConfigSource configSource = builderType.getAnnotation(ConfigSource.class); if (configSource == null || isEmpty(configSource.value())) { throw new IllegalArgumentException("Listener does not declare any config sources"); } for (String source : configSource.value()) { List<ConsoleConfigListener> listeners = sourceListeners.get(source); if (listeners == null) { listeners = new CopyOnWriteArrayList<>(); List<ConsoleConfigListener> existingListeners = sourceListeners.putIfAbsent(source, listeners); if (existingListeners != null) { listeners = existingListeners; } else { registerForSourceChanges(source); } } listeners.add(listener); } } @Inject  ConsoleConfigHandlerImpl(SMSConfigProvider configProvider, DNWrapper dnUtils, Injector injector); @Override C getConfig(String realm, Class<? extends ConsoleConfigBuilder<C>> builderType); @Override void registerListener(ConsoleConfigListener listener, Class<? extends ConsoleConfigBuilder<?>> builderType);  }### Answer:
@Test public void listenerGetsNotifiedOnChange() { ConsoleConfigListener listener = mock(ConsoleConfigListener.class); given(dnUtils.orgNameToRealmName("ou=abc,ou=def")).willReturn("/"); consoleConfigHandler.registerListener(listener, MockListenerBeanBuilder.class); verify(configProvider).registerListener(eq("MockListenerSource"), serviceListenerCaptor.capture()); ServiceListener serviceListener = serviceListenerCaptor.getValue(); serviceListener.organizationConfigChanged("MockListenerSource", "1.0", "ou=abc,ou=def", "", "", 0); verify(listener).configUpdate("MockListenerSource", "/"); }