### Question:
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);  }### Answer:
@Test public void should_handle_noop_name() { InvocationDataPublisher publisher = factory.create(NoOpInvocationDataPublisherImpl.NAME, config); assertThat(publisher, instanceOf(NoOpInvocationDataPublisherImpl.class)); output.expect(is("")); }
@Test public void should_handle_http_name() { InvocationDataPublisher publisher = factory.create(HttpInvocationDataPublisherImpl.NAME, config); assertThat(publisher, instanceOf(HttpInvocationDataPublisherImpl.class)); output.expect(is("")); }
@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")); }