### Question:
PublishersCompiler { @VisibleForTesting static UpdateListener instantiateUpdateListener(final PublisherConfig publisherConfig) throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException { final String listenerType = publisherConfig.getType(); final Class listenerClass = Class.forName(listenerType); Constructor<?> defaultConstructor = null; Constructor<?> configConstructor = null; for (final Constructor<?> constructor : listenerClass.getConstructors()) { if (constructor.getParameterTypes() == null || constructor.getParameterTypes().length == 0) { defaultConstructor = constructor; } else if (constructor.getParameterTypes().length == 1) { configConstructor = constructor; } } final UpdateListener listener; if (configConstructor != null) { final Class listenerConfigClass = configConstructor.getParameterTypes()[0]; listener = (UpdateListener) configConstructor.newInstance(listenerConfigClass.cast(publisherConfig)); } else if (defaultConstructor != null) { listener = (UpdateListener) defaultConstructor.newInstance(); } else { throw new IllegalArgumentException("Can't find a suitable constructor in subscribers class " + listenerClass.getName()); } return listener; } @Inject  PublishersCompiler(final List<PublisherConfig> publisherConfigs, final List<StreamConfig> streamConfigs, final EPServiceProvider epService); Map<String, UpdateListener> getPublisherInstances(); Map<String, PublisherConfig> getPublisherConfigs(); Map<String, StreamConfig> getStreamConfigs(); void addStream(final StreamConfig streamConfig);  }### Answer:
@Test(groups = "fast") public void testInstantiateListener() throws Exception { final UpdateListener listener = PublishersCompiler.instantiateUpdateListener(publisherConfig); assertTrue(listener instanceof DebugListener); }