oghenez / mycila

Automatically exported from code.google.com/p/mycila
0 stars 0 forks source link

Having trouble getting class that extend AbstractMycilaTestNGTest to inject #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If I use

@BeforeClass
   public void setup() {
       TestSetup.setup(this);
   }

All my injections take place, however just extending
AbstractMycilaTestNGTest is not working for me. I'm currently using maven
to run the tests and using Guice2 but I had the same problem using Guice1
as well.

I've tried to narrow things down to as small as possible and I've posted
some relevant information on the setup here

http://pastie.org/362139

associateDAO will be null when the test case runs. 

Original issue reported on code.google.com by ric...@gmail.com on 16 Jan 2009 at 3:15

GoogleCodeExporter commented 8 years ago
Hi,

Like you i am using it the same was. Here is my unit test and my maven 
dependencies
here: http://pastie.org/369396

 * I am using mycila release 1.0 (but it should be the same as 1.0-rc2)
 * I am excluding junit, since it comes transitively from testng and is useless to my
opinion, except for migration purposes
 * I have @Test annotations on my test methods
 * I don't have any testng files: maven does not need any configuration at all to 
run tests: just as simple as junit test ;)

Also, for information,

 * If i need integration tests, i call them in example *IntTest or i put them in an
integration package and i used maven profiles with two different surefire
configurations, one executing unit test by default and the other executing
integration tests, and if i need a deployment to be done before, i bind the
integration-test phase, thus executing integration tests after the packaging and
deploying on server.

Hope it'll help...

Original comment by mathieu....@gmail.com on 24 Jan 2009 at 4:31

GoogleCodeExporter commented 8 years ago
Thanks for posting! I have no idea what was wrong with my code, but I'm glad 
you made
me revisit it, since it seems fine now. I'd love to investigate what I had set 
up
wrong, but for now things seems to be going well. Thanks again. I really 
appreciate
your plugin. Feel free to delete this issue since apparently it is a 'non 
issue.' If
I figure out what I had set up wrong, I'll let you know in case someone else 
runs
into the same thing. Thanks again.

Original comment by ric...@gmail.com on 27 Jan 2009 at 3:30

GoogleCodeExporter commented 8 years ago
Ok i will mark it as WontFix. Thanks !

NB: i released a 1.2 version this week-end to add support for Guice 2 (now 
there is a
Guice 2 plugin). It's cool since now you can benefits if new Guice 2 fatures 
such as
binding override. You can use your whole production module in @GuiceContext and 
put
your bindings with @Bind that you want to override. The Guice 2 plugin uses the 
same
annotations as Guice 1.

Original comment by mathieu....@gmail.com on 27 Jan 2009 at 4:15