Hi to all,

I'm writing a cdi extension to write unit tests with easymock.

I would like to be able to unit test interceptors as well as other cdi
beans.
Here's an example of how the test looks like:

https://github.com/marciopd/easymock/blob/master/easymock-cdiextension/src/test/java/org/easymock/cdi/interceptor/InterceptorTest.java


I was able to make this work in Weld using the following code:
    /**
     * Processes enabled interceptors.
     * @param event enabled bean event
     */
    @SuppressWarnings("rawtypes")
    public void processEnabledInterceptor(
            @Observes final ProcessBean event) {
        final Bean bean = event.getBean();
        if (bean instanceof Interceptor) {
            wrapInterceptorTestSubjectInjectionTarget(bean);
        }
    }

https://github.com/marciopd/easymock/blob/master/easymock-cdiextension/src/main/java/org/easymock/cdi/extension/EasymockCdiExtension.java


Any idea of how this could be done in OWB?


Thanks,
Marcio Dantas

PS: There are maven profiles to test against OWB.
Example: mvn clean test -Popenwebbeans-1.2.0

Reply via email to