@Test(expected = InterceptionException.class) public void shouldComplainWhenUnableToInstantiateAnInterceptor() throws InterceptionException, IOException { when(container.instanceFor(MyWeirdInterceptor.class)).thenReturn(null); ToInstantiateInterceptorHandler handler = new ToInstantiateInterceptorHandler(container, MyWeirdInterceptor.class); handler.execute(null, null, null); }
public void execute(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException { Interceptor interceptor = container.instanceFor(type); if (interceptor == null) { throw new InterceptionException("Unable to instantiate interceptor for " + type.getName() + ": the container returned null."); } if (interceptor.accepts(method)) { logger.debug("Invoking interceptor {}", interceptor.getClass().getSimpleName()); interceptor.intercept(stack, method, resourceInstance); } else { stack.next(method, resourceInstance); } }
ToInstantiateInterceptorHandler implements InterceptorHandler { public void execute(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException { Interceptor interceptor = container.instanceFor(type); if (interceptor == null) { throw new InterceptionException("Unable to instantiate interceptor for " + type.getName() + ": the container returned null."); } if (interceptor.accepts(method)) { logger.debug("Invoking interceptor {}", interceptor.getClass().getSimpleName()); interceptor.intercept(stack, method, resourceInstance); } else { stack.next(method, resourceInstance); } } }
ToInstantiateInterceptorHandler implements InterceptorHandler { public void execute(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException { Interceptor interceptor = container.instanceFor(type); if (interceptor == null) { throw new InterceptionException("Unable to instantiate interceptor for " + type.getName() + ": the container returned null."); } if (interceptor.accepts(method)) { logger.debug("Invoking interceptor {}", interceptor.getClass().getSimpleName()); interceptor.intercept(stack, method, resourceInstance); } else { stack.next(method, resourceInstance); } } ToInstantiateInterceptorHandler(Container container, Class<? extends Interceptor> type); }
ToInstantiateInterceptorHandler implements InterceptorHandler { public void execute(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException { Interceptor interceptor = container.instanceFor(type); if (interceptor == null) { throw new InterceptionException("Unable to instantiate interceptor for " + type.getName() + ": the container returned null."); } if (interceptor.accepts(method)) { logger.debug("Invoking interceptor {}", interceptor.getClass().getSimpleName()); interceptor.intercept(stack, method, resourceInstance); } else { stack.next(method, resourceInstance); } } ToInstantiateInterceptorHandler(Container container, Class<? extends Interceptor> type); void execute(InterceptorStack stack, ResourceMethod method, Object resourceInstance); @Override String toString(); }
ToInstantiateInterceptorHandler implements InterceptorHandler { public void execute(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException { Interceptor interceptor = container.instanceFor(type); if (interceptor == null) { throw new InterceptionException("Unable to instantiate interceptor for " + type.getName() + ": the container returned null."); } if (interceptor.accepts(method)) { logger.debug("Invoking interceptor {}", interceptor.getClass().getSimpleName()); interceptor.intercept(stack, method, resourceInstance); } else { stack.next(method, resourceInstance); } } ToInstantiateInterceptorHandler(Container container, Class<? extends Interceptor> type); void execute(InterceptorStack stack, ResourceMethod method, Object resourceInstance); @Override String toString();  }