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

Marius Bogoevici mariusb at redhat.com
Tue Jul 20 10:54:36 EDT 2010


Hey Marcin,

Please note that SimpleInterceptorTest.testInterceptorModel verifies that interceptor bindings are transitive, in other words that @SecondaryInterceptionBinding inherits @PrimaryInterceptionBinding as per section 9.1.1 of the specification.

In your case, @Perf4jProfiled does not have any transitive interceptor bindings defined on it so getInheritedInterceptionBindingTypes() will return an empty set.

Also, please note that InterceptorBindingModel is an implementation detail of Weld and it may change in the future.

Hope this helps.
Marius

On 2010-07-18, at 11:07 AM, Marcin Zajączkowski wrote:

> 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
> 
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev




More information about the weld-dev mailing list