Hello, I've been trying to start the CDI container during Junit-Testing as described at the following page,
http://struberg.wordpress.com/2012/03/27/unit-testing-strategies-for-cdi-based-projects/ though I'm using Junit 4 and implemented everything using a new Runner (to annotate tests with @RunWith). I kind of got inspired by he CDIUnit project, but it works only with Weld and I want to use OpenWebBeans. The major things like injection work perfectly, however, I realized, that even though I implemented the following code to provided a CDI aware Test-Class, an interceptor annotation on a test method is completely ignored, thus the interceptors AroundInvoke annotated method is not called. private <T> T createTest(final Class<T> testClass) throws Exception { final BeanManager beanManager = cdiContainer.getBeanManager(); final CreationalContext<T> creationalContext = beanManager.createCreationalContext(null); final AnnotatedType<T> annotatedType = beanManager.createAnnotatedType(testClass); final InjectionTarget<T> injectionTarget = beanManager.createInjectionTarget(annotatedType); final T result = (T) getTestClass().getOnlyConstructor().newInstance(); injectionTarget.inject(result, creationalContext); return result; } Is this expected behaviour? I'm not so familiar with how interceptors are really implemented, but I would have guest that after providing a creational context and complete injection for the test class, interceptor annotations should work too. The interceptor itself is registered correctly. It is listed among all interceptors when calling WebBeansContext.currentInstance().getInterceptorsManager().getCdiInterceptors() however, a test annotated with the interceptor does not trigger execution of the AroundInvoke-method. Would be great, if somebody has a thought or a hint on this. Thanks, Heiko If you are not the addressee, please inform us immediately that you have received this e-mail by mistake, and delete it. We thank you for your support.
