Hi Christian,

> It might make sense to have a "hit" annotation for Testify that 
> follows @Inject which allows the injection to be beforeMethod or 
> beforeClass.  Unfortunately, we can't re-use the jUnit ones because 
> (if I recall correctly) they are not suitable for Field annotation, 
> just method.  But something similar would be good.  Maybe 
> @InjectBeforeTest and @InjectBeforeSuite could do it.

I'm not seeing why that would be useful. I would expect the @Inject 
annotation to be injecting the same object whenever it is processed - it's 
just a question of when that injection takes place for each instance of 
the test class (e.g. at the start of the test class/before each test 
method).

JUnit (3 and I assume 4) makes a new instance of the test class to run 
each test method, so it makes sense to process @Inject for every test 
method in order to populate that new instance.

TestNG makes one instance of the test class for all the test methods in 
it, so it makes sense to process @Inject just once using TestNG's 
@BeforeClass. 

As usual, I may have missed something so feel free to educate me :-)

- Paul


---

This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error) please 
notify the sender immediately and delete this e-mail. Any unauthorized copying, 
disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional 
EU corporate and regulatory disclosures.

Reply via email to