@Test public void should_warn_when_unrecognized_name() throws Exception { CodeBasePublisher publisher = factory.create("foobar", config); assertThat(publisher, instanceOf(NoOpCodeBasePublisherImpl.class)); output.expect(containsString("[WARNING]")); output.expect( containsString("Unrecognized code base publisher name: 'foobar', will use no-op")); }
@Override public CodeBasePublisher create(String name, AgentConfig config) { if (name.equals(NoOpCodeBasePublisherImpl.NAME)) { return new NoOpCodeBasePublisherImpl(config); } if (name.equals(HttpCodeBasePublisherImpl.NAME)) { return new HttpCodeBasePublisherImpl(config); } logger.warning( String.format( "Unrecognized code base publisher name: '%s', will use %s", name, NoOpCodeBasePublisherImpl.NAME)); return new NoOpCodeBasePublisherImpl(config); }
CodeBasePublisherFactoryImpl implements CodeBasePublisherFactory { @Override public CodeBasePublisher create(String name, AgentConfig config) { if (name.equals(NoOpCodeBasePublisherImpl.NAME)) { return new NoOpCodeBasePublisherImpl(config); } if (name.equals(HttpCodeBasePublisherImpl.NAME)) { return new HttpCodeBasePublisherImpl(config); } logger.warning( String.format( "Unrecognized code base publisher name: '%s', will use %s", name, NoOpCodeBasePublisherImpl.NAME)); return new NoOpCodeBasePublisherImpl(config); } }
CodeBasePublisherFactoryImpl implements CodeBasePublisherFactory { @Override public CodeBasePublisher create(String name, AgentConfig config) { if (name.equals(NoOpCodeBasePublisherImpl.NAME)) { return new NoOpCodeBasePublisherImpl(config); } if (name.equals(HttpCodeBasePublisherImpl.NAME)) { return new HttpCodeBasePublisherImpl(config); } logger.warning( String.format( "Unrecognized code base publisher name: '%s', will use %s", name, NoOpCodeBasePublisherImpl.NAME)); return new NoOpCodeBasePublisherImpl(config); }  }
CodeBasePublisherFactoryImpl implements CodeBasePublisherFactory { @Override public CodeBasePublisher create(String name, AgentConfig config) { if (name.equals(NoOpCodeBasePublisherImpl.NAME)) { return new NoOpCodeBasePublisherImpl(config); } if (name.equals(HttpCodeBasePublisherImpl.NAME)) { return new HttpCodeBasePublisherImpl(config); } logger.warning( String.format( "Unrecognized code base publisher name: '%s', will use %s", name, NoOpCodeBasePublisherImpl.NAME)); return new NoOpCodeBasePublisherImpl(config); }  @Override CodeBasePublisher create(String name, AgentConfig config); }
CodeBasePublisherFactoryImpl implements CodeBasePublisherFactory { @Override public CodeBasePublisher create(String name, AgentConfig config) { if (name.equals(NoOpCodeBasePublisherImpl.NAME)) { return new NoOpCodeBasePublisherImpl(config); } if (name.equals(HttpCodeBasePublisherImpl.NAME)) { return new HttpCodeBasePublisherImpl(config); } logger.warning( String.format( "Unrecognized code base publisher name: '%s', will use %s", name, NoOpCodeBasePublisherImpl.NAME)); return new NoOpCodeBasePublisherImpl(config); }  @Override CodeBasePublisher create(String name, AgentConfig config);  }