I think that @BeforeMethod is a better one to key off-of. If singleton-scoped objects are the only ones being injected, then @BeforeClass makes sense, but if you're testing per-request or per- session objects, then it's best to use @BeforeMethod, since you may be setting state on these which needs to be fresh for each test.

cheers,
Christian.

On 2009-07-27, at 05:00 , Paul Field wrote:

Hi Rolf,


Hi I am using Testify to inject a fake repository into my testng test
but I
come op to a problem.

when i first access the fake repository it gets injected however the
second
time i access the repository I get a null pointer exception.

Now comes another strange thing when i debug everything works fine and
the
repository gets injected perfectly.

At the moment Testify's TestNG integration is using @BeforeClass to
process the @Inject annotations. So I can see that there might be possible
scenarios that match yours: something where the '@Inject'ed field is
cleared between tests for example... but it's hard to know exactly what's
happening from your description.

Could you give some more information (e.g. code examples) that show the problem? Also, when you debug, are you running exactly the same suite as when you aren't debugging? And is the behaviour consistent if you try this
multiple times?

Thanks,

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.

Christian Edward Gruber
e-mail: christianedwardgru...@gmail.com
weblog: http://www.geekinasuit.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to