joepadde / mockito

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

Support for @Inject #442

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
JSR 330 adds support for @Inject. See: 
http://www.vogella.com/articles/DependencyInjection/article.html#dependencyinjec
tion_annotations for more details.

Do you have plans to support Mock injection based on these annotations? I think 
it would be similar to 
http://docs.mockito.googlecode.com/hg/org/mockito/InjectMocks.html but based on 
the annotations and not on the type

Original issue reported on code.google.com by Lars.Vo...@gmail.com on 30 Jun 2013 at 4:54

GoogleCodeExporter commented 8 years ago
You can opt for an own junit test runner. See jukito library which marries 
happily Gin/Guide based DI annotations with mockito.

Original comment by marius...@gmail.com on 30 Jun 2013 at 9:24

GoogleCodeExporter commented 8 years ago

The Needle Testframework (http://needle.spree.de) supports the JSR330 and is 
well integrated with Mockito. 

Original comment by heinz.wi...@akquinet.de on 14 Aug 2013 at 8:56

GoogleCodeExporter commented 8 years ago
@Inject or @Autowired or whatever will never be supported by mockito unless 
J2SE integrates it, and then if it happens it won't be until JDK8+.

The reason for that is we don't want any adherence to something outside the 
JRE. However it may be interesting to provide a way to provide a custom 
injecter to mockito.
BUT this should be elegant and Mockito is not an injection framework.

Original comment by brice.du...@gmail.com on 4 Dec 2013 at 1:19