4 Replies Latest reply on Apr 20, 2014 5:26 AM by Danil Erofeev

    CDI Interceptor doesn't get executed

    Simon Rettenmeier Newbie

      Hi together,


      currently I'd like to test an interceptor which logs occuring exceptions via Arquillian. I've created an interceptor, an InterceptorBinding annotation and annotated my class under test accordingly. But when I'm executing the test the interceptor won't be called. Does Arquillian support CDI interceptors?


      My interceptor:

      public class ExceptionInterceptor {
          public Object handleException(InvocationContext ctx) throws Exception {
              try {
                  Object o = ctx.proceed();
                  System.out.println("No exception!!");
                  return o;
              } catch (Exception e) {
                  return null;


      My interceptor binding annotation:

      @Target({METHOD, TYPE})
      public @interface Exceptional {}


      My beans-test.xml

      <beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"


      My test class:

      public class ExceptionHandlingTest {
          public static Archive<?> deploy() {
              return ShrinkWrap
                  .addClasses(ExceptionBean.class, Exceptional.class, ExceptionInterceptor.class)
                  .addAsManifestResource("META-INF/beans-test.xml", "beans.xml");
          private ExceptionBean bean;
          public void testInterceptor() {
              String hello = bean.sayHello();
              assertThat("Hi!", is(hello));


      Thanks in advance for any comment...