### Question:
Report { public static void info(String message) { STUB.get().info(message); } private  Report(); static void info(String message); static void info(String message, Throwable throwable); static void warn(String message); static void warn(String message, Throwable throwable); static void error(String message); static void error(String message, Throwable throwable); static ApiStub<ReportApi> getStub(); static final String K_DELEGATE_CLASS; }### Answer:
@Test(expected = Report.FailedException.class) public void noDelegate() { Report.info("Hello"); }
@Test public void info() { delegate(new Mock()); Report.info("Hello"); assertThat(Mock.levels, is(list(Level.INFO))); assertThat(Mock.messages, is(list("Hello"))); }
@Test(expected = Report.FailedException.class) public void info_error() { delegate(new Report.Delegate() { @Override public void report(Level level, String message) throws IOException { throw new IOException(); } }); Report.info("Hello"); }
@Test public void initialize() throws Exception { ResourceConfiguration conf = new HadoopConfiguration(); conf.set(Report.K_DELEGATE_CLASS, Mock.class.getName()); LegacyReport.Initializer init = new LegacyReport.Initializer(); init.setup(conf); Report.info("hello"); init.cleanup(conf); assertThat(Mock.levels, is(list(Level.INFO))); assertThat(Mock.messages, is(list("hello"))); }