@Test public void should_warn_when_unrecognized_name() { InvocationDataPublisher publisher = factory.create("foobar", config); assertThat(publisher, instanceOf(NoOpInvocationDataPublisherImpl.class)); output.expect(containsString("[WARNING]")); output.expect( containsString("Unrecognized invocation data publisher name: 'foobar', will use no-op")); }
@Override public InvocationDataPublisher create(String name, AgentConfig config) { if (name.equals(NoOpInvocationDataPublisherImpl.NAME)) { return new NoOpInvocationDataPublisherImpl(config); } if (name.equals(HttpInvocationDataPublisherImpl.NAME)) { return new HttpInvocationDataPublisherImpl(config); } logger.warning( String.format( "Unrecognized invocation data publisher name: '%s', will use %s", name, NoOpInvocationDataPublisherImpl.NAME)); return new NoOpInvocationDataPublisherImpl(config); }
InvocationDataPublisherFactoryImpl implements InvocationDataPublisherFactory { @Override public InvocationDataPublisher create(String name, AgentConfig config) { if (name.equals(NoOpInvocationDataPublisherImpl.NAME)) { return new NoOpInvocationDataPublisherImpl(config); } if (name.equals(HttpInvocationDataPublisherImpl.NAME)) { return new HttpInvocationDataPublisherImpl(config); } logger.warning( String.format( "Unrecognized invocation data publisher name: '%s', will use %s", name, NoOpInvocationDataPublisherImpl.NAME)); return new NoOpInvocationDataPublisherImpl(config); } }
InvocationDataPublisherFactoryImpl implements InvocationDataPublisherFactory { @Override public InvocationDataPublisher create(String name, AgentConfig config) { if (name.equals(NoOpInvocationDataPublisherImpl.NAME)) { return new NoOpInvocationDataPublisherImpl(config); } if (name.equals(HttpInvocationDataPublisherImpl.NAME)) { return new HttpInvocationDataPublisherImpl(config); } logger.warning( String.format( "Unrecognized invocation data publisher name: '%s', will use %s", name, NoOpInvocationDataPublisherImpl.NAME)); return new NoOpInvocationDataPublisherImpl(config); }  }
InvocationDataPublisherFactoryImpl implements InvocationDataPublisherFactory { @Override public InvocationDataPublisher create(String name, AgentConfig config) { if (name.equals(NoOpInvocationDataPublisherImpl.NAME)) { return new NoOpInvocationDataPublisherImpl(config); } if (name.equals(HttpInvocationDataPublisherImpl.NAME)) { return new HttpInvocationDataPublisherImpl(config); } logger.warning( String.format( "Unrecognized invocation data publisher name: '%s', will use %s", name, NoOpInvocationDataPublisherImpl.NAME)); return new NoOpInvocationDataPublisherImpl(config); }  @Override InvocationDataPublisher create(String name, AgentConfig config); }
InvocationDataPublisherFactoryImpl implements InvocationDataPublisherFactory { @Override public InvocationDataPublisher create(String name, AgentConfig config) { if (name.equals(NoOpInvocationDataPublisherImpl.NAME)) { return new NoOpInvocationDataPublisherImpl(config); } if (name.equals(HttpInvocationDataPublisherImpl.NAME)) { return new HttpInvocationDataPublisherImpl(config); } logger.warning( String.format( "Unrecognized invocation data publisher name: '%s', will use %s", name, NoOpInvocationDataPublisherImpl.NAME)); return new NoOpInvocationDataPublisherImpl(config); }  @Override InvocationDataPublisher create(String name, AgentConfig config);  }