TracingListenerFactory { @SuppressWarnings("unchecked") public static TracingListener getListener(final TracingConfiguration tracingConfig) throws TracingConfigurationException { if (Strings.isNullOrEmpty(tracingConfig.getType()) || !LISTENER_CONFIGS.containsKey(tracingConfig.getType())) { throw new TracingConfigurationException(String.format("Can not find executor service handler type '%s'.", tracingConfig.getType())); } return LISTENER_CONFIGS.get(tracingConfig.getType()).createTracingListener(tracingConfig.getStorage()); }  @SuppressWarnings("unchecked") static TracingListener getListener(final TracingConfiguration tracingConfig);  }
@Test(expected = TracingConfigurationException.class) public void assertGetListenerWithNullType() throws TracingConfigurationException { TracingListenerFactory.getListener(new TracingConfiguration<>("", null)); }
@Test(expected = TracingConfigurationException.class) public void assertGetInvalidListener() throws TracingConfigurationException { TracingListenerFactory.getListener(new TracingConfiguration<>("INVALID", null)); }
@Test public void assertGetListener() throws TracingConfigurationException { assertThat(TracingListenerFactory.getListener(new TracingConfiguration<>("TEST", null)), instanceOf(TestTracingListener.class)); }