[weld-dev] Problem with getInheritedInterceptionBindingTypes() in mock test

Marcin Zajączkowski mszpak at wp.pl
Sun Jul 18 11:07:47 EDT 2010


Hello again,


After some complications I was able to set up mock tests for my
interceptor, but I have one question. Test taken from
SimpleInterceptorTest.testInterceptorModel dosn't work with my interceptor.

@Artifact
@BeansXml("beans.xml")
public class Perf4jProfiledInterceptorTest extends AbstractWeldTest {

    @Test
    public void testInterceptorModel()
    {
       InterceptorBindingModel<Perf4jProfiled> interceptorBindingModel
             = new
InterceptorBindingModel<Perf4jProfiled>(Perf4jProfiled.class, new
ClassTransformer(new TypeStore()));
       Set<Annotation> annotations =
interceptorBindingModel.getInheritedInterceptionBindingTypes();
       Assert.assertTrue(annotations.size() != 0);
    }
}

It's not a big problem for me, but
getInheritedInterceptionBindingTypes() returns empty set. I looked into
code of using classes and I suspect that something is not initialized. I
curious what I did wrong?


@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@InterceptorBinding
public @interface Perf4jProfiled {
}

Proper beans.xml has my interceptor defined.


Regards
Marcin



More information about the weld-dev mailing list