### Question:
SubscribersCompiler { static Subscriber instantiateSubscriber(EPServiceProvider epService, SubscriberConfig subscriberConfig) throws InstantiationException, IllegalAccessException, InvocationTargetException { if (subscriberConfig.getEventOutputName() == null) { throw new IllegalStateException("Esper topic key not specified!"); } Class subscriberKlass; try { String subscriberKlassName = subscriberConfig.getType(); subscriberKlass = Class.forName(subscriberKlassName); } catch (ClassNotFoundException e) { throw new IllegalStateException("Class not found for: " + subscriberConfig.getType()); } Constructor<?> constructor = null; Class subscriberConfigKlass = null; for (Constructor<?> cstr : subscriberKlass.getConstructors()) { if (cstr.getParameterTypes().length == 2) { constructor = cstr; subscriberConfigKlass = cstr.getParameterTypes()[0]; } } if (constructor != null && subscriberConfigKlass != null) { if (subscriberConfig.isEnabled()) { return (Subscriber) constructor.newInstance(subscriberConfigKlass.cast(subscriberConfig), epService); } else { log.info("Skipping disabled subscriber: " + subscriberConfig.getName()); return null; } } else { throw new IllegalArgumentException("Can't find a suitable constructor in subscribers class " + subscriberKlass); } } @Inject  SubscribersCompiler(List<SubscriberConfig> subscribersConfigs, EPServiceProvider epService); ArrayList<Subscriber> getSubscribers(); void startAll(); void stopAll();  }### Answer:
@Test public void testInstantiateSubscriber() throws Exception { Subscriber subscriber = SubscribersCompiler.instantiateSubscriber(new MockEPServiceProvider(), subscriberConfig); assertTrue(subscriber instanceof JMXSubscriber); }