@Test public void shouldReportExceptions() throws Exception { final RuntimeException expected = new RuntimeException("expected"); loggingUpdate = new LoggingUpdate<>( new Update<String, Integer, Boolean>() { @Nonnull @Override public Next<String, Boolean> update(String model, Integer event) { throw expected; } }, logger); try { loggingUpdate.update("log this plx", 13); } catch (Exception e) { } assertThat( logger.updateErrors, contains(CapturingLogger.UpdateErrorArgs.create("log this plx", 13, expected))); }
@Nonnull @Override public Next<M, F> update(M model, E event) { logger.beforeUpdate(model, event); Next<M, F> result = safeInvokeUpdate(model, event); logger.afterUpdate(model, event, result); return result; }
LoggingUpdate implements Update<M, E, F> { @Nonnull @Override public Next<M, F> update(M model, E event) { logger.beforeUpdate(model, event); Next<M, F> result = safeInvokeUpdate(model, event); logger.afterUpdate(model, event, result); return result; } }
LoggingUpdate implements Update<M, E, F> { @Nonnull @Override public Next<M, F> update(M model, E event) { logger.beforeUpdate(model, event); Next<M, F> result = safeInvokeUpdate(model, event); logger.afterUpdate(model, event, result); return result; } LoggingUpdate(Update<M, E, F> actualUpdate, MobiusLoop.Logger<M, E, F> logger); }
LoggingUpdate implements Update<M, E, F> { @Nonnull @Override public Next<M, F> update(M model, E event) { logger.beforeUpdate(model, event); Next<M, F> result = safeInvokeUpdate(model, event); logger.afterUpdate(model, event, result); return result; } LoggingUpdate(Update<M, E, F> actualUpdate, MobiusLoop.Logger<M, E, F> logger); @Nonnull @Override Next<M, F> update(M model, E event); }
LoggingUpdate implements Update<M, E, F> { @Nonnull @Override public Next<M, F> update(M model, E event) { logger.beforeUpdate(model, event); Next<M, F> result = safeInvokeUpdate(model, event); logger.afterUpdate(model, event, result); return result; } LoggingUpdate(Update<M, E, F> actualUpdate, MobiusLoop.Logger<M, E, F> logger); @Nonnull @Override Next<M, F> update(M model, E event);  }