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

Marcin Zajączkowski mszpak at wp.pl
Wed Jul 28 06:18:07 EDT 2010


On 2010-07-20 16:54, Marius Bogoevici wrote:
> 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.

I see. Thanks for your explanations Marius.


Regards
Marcin


> 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
> 
> 
> _______________________________________________
> 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