ExceptionRecorder implements MethodInvocation<T> { public void replay(Result result) { Object current = result; for (ExceptionRecorderParameter p : parameters) { current = new Mirror().on(current).invoke().method(p.getMethod()).withArgs(p.getArgs()); } } ExceptionRecorder(Proxifier proxifier); @SuppressWarnings({ "unchecked", "rawtypes" }) Object intercept(T proxy, Method method, Object[] args, SuperMethod superMethod); void replay(Result result);  }
@Test public void withRootException() { mapper.record(Exception.class).forwardTo(DEFAULT_REDIRECT); mapper.findByException(new Exception()).replay(result); verify(result).forwardTo(DEFAULT_REDIRECT); }
@Test public void withNestedException() { mapper.record(IllegalStateException.class).forwardTo(DEFAULT_REDIRECT); mapper.findByException(new RuntimeException(new IllegalStateException())).replay(result); verify(result).forwardTo(DEFAULT_REDIRECT); }