public void shouldPassCaughtExceptionsToHandler() throws Exception {
final QueuedObjectHolder exceptionHolder = new QueuedObjectHolder();
final RuntimeException exception = new RuntimeException("An exception occurred");
Mock handler = mock(ErrorHandler.class);
handler.expects("handle").will(new InvocationHandler() {
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
exceptionHolder.set(args[0]);
return null;
}
});