[infinispan-dev] Change AbstractInfinispanTest.nullifyInstanceFields method name to zzzNullifyInstanceFields

Galder Zamarreno galder at redhat.com
Mon Oct 19 11:46:34 EDT 2009



On 10/19/2009 05:27 PM, Vladimir Blagojevic wrote:
> On 09-10-19 10:17 AM, Galder Zamarreno wrote:
>>
>> On 10/19/2009 03:46 PM, Vladimir Blagojevic wrote:
>>
>>> You gotta be kidding! Are you sure that your method is annotated with
>>> @AfterClass and not @AfterTest. Is this in svn? I'd like to try it myself!
>>>
>> I'm not kidding and I'm sure :)
>>
>> I've just committed it, r969. Do an svn updated, revert to the
>> AbstractInfinispanTest.nullifyInstanceFields and run
>> org.infinispan.jndi.BindingTest and you'll see an NPE being thrown in
>> the preDestroy() method.
>>
>>
> destroyAfterClass in SingleCacheManagerTest with its dependsOnMethods
> annotation field is throwing the order off. If you remove
> dependsOnMethods field and remove preDestroy method in
> SingleCacheManagerTest everything works as expected. Try it yourself.
>
> These dependsOnMethods annotation fields complicate things for no
> reason. If we do not use them the order of invocation of @AfterClass
> methods is always from the leaf all the way up to ancestor.

So, what you're saying here is that if I remove the dependsOnMethods, 
the order in which the @AfterClass calls would run would be the following?

1. BindingTest.preDestroy()
2. SingleCacheManagerTest.destroyAfterClass()
3. AbstractInfinispanTest.nullifyInstanceFields()

Note: Just tried this and it works as you said :).

I used this method based on the preCreate() stuff and @BeforeClass I saw 
in SingleCacheManagerTest, so probably this is not even needed either, 
assuming that the lower @BeforeClass would be executed first.

>
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev

-- 
Galder Zamarreño
Sr. Software Engineer
Infinispan, JBoss Cache



More information about the infinispan-dev mailing list