@Test public void shouldReportExceptions() throws Exception { final RuntimeException expected = new RuntimeException("expected"); loggingInit = new LoggingInit<>( new Init<String, Integer>() { @Nonnull @Override public First<String, Integer> init(String model) { throw expected; } }, logger); try { loggingInit.init("log this plx"); } catch (Exception e) { } assertThat( logger.initErrors, contains(CapturingLogger.InitErrorArgs.create("log this plx", expected))); }
@Nonnull @Override public First<M, F> init(M model) { logger.beforeInit(model); First<M, F> result = safeInvokeInit(model); logger.afterInit(model, result); return result; }
LoggingInit implements Init<M, F> { @Nonnull @Override public First<M, F> init(M model) { logger.beforeInit(model); First<M, F> result = safeInvokeInit(model); logger.afterInit(model, result); return result; } }
LoggingInit implements Init<M, F> { @Nonnull @Override public First<M, F> init(M model) { logger.beforeInit(model); First<M, F> result = safeInvokeInit(model); logger.afterInit(model, result); return result; } LoggingInit(Init<M, F> actualInit, MobiusLoop.Logger<M, ?, F> logger); }
LoggingInit implements Init<M, F> { @Nonnull @Override public First<M, F> init(M model) { logger.beforeInit(model); First<M, F> result = safeInvokeInit(model); logger.afterInit(model, result); return result; } LoggingInit(Init<M, F> actualInit, MobiusLoop.Logger<M, ?, F> logger); @Nonnull @Override First<M, F> init(M model); }
LoggingInit implements Init<M, F> { @Nonnull @Override public First<M, F> init(M model) { logger.beforeInit(model); First<M, F> result = safeInvokeInit(model); logger.afterInit(model, result); return result; } LoggingInit(Init<M, F> actualInit, MobiusLoop.Logger<M, ?, F> logger); @Nonnull @Override First<M, F> init(M model);  }