@Test public void whenNotFoundException() { final Exception e = new IllegalArgumentException(); when(mapper.findByException(e)).thenReturn(null); doThrow(new InterceptionException(e)).when(stack).next(method, instance); try { interceptor.intercept(stack, method, instance); fail("Should throw InterceptionException"); } catch (InterceptionException e2) { assertEquals(e2.getCause(), e); } }
public void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException { try { stack.next(method, resourceInstance); } catch (InterceptionException e) { if (!(e.getCause() instanceof Exception) || !replay((Exception) e.getCause())) { throw e; } } }
ExceptionHandlerInterceptor implements Interceptor { public void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException { try { stack.next(method, resourceInstance); } catch (InterceptionException e) { if (!(e.getCause() instanceof Exception) || !replay((Exception) e.getCause())) { throw e; } } } }
ExceptionHandlerInterceptor implements Interceptor { public void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException { try { stack.next(method, resourceInstance); } catch (InterceptionException e) { if (!(e.getCause() instanceof Exception) || !replay((Exception) e.getCause())) { throw e; } } } ExceptionHandlerInterceptor(ExceptionMapper exceptions, Result result); }
ExceptionHandlerInterceptor implements Interceptor { public void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException { try { stack.next(method, resourceInstance); } catch (InterceptionException e) { if (!(e.getCause() instanceof Exception) || !replay((Exception) e.getCause())) { throw e; } } } ExceptionHandlerInterceptor(ExceptionMapper exceptions, Result result); boolean accepts(ResourceMethod method); void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance); }
ExceptionHandlerInterceptor implements Interceptor { public void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException { try { stack.next(method, resourceInstance); } catch (InterceptionException e) { if (!(e.getCause() instanceof Exception) || !replay((Exception) e.getCause())) { throw e; } } } ExceptionHandlerInterceptor(ExceptionMapper exceptions, Result result); boolean accepts(ResourceMethod method); void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance);  }