1

I want to test a set of classes but my environment is based on Jboss 7.

In those classes, I have a lot fields that are injected with @Inject but when I run my tests, those fields are Null.

I was wondering if there were some "JbossRunner", like Springjunit4classrunner where it can inject the fields in my classes. I am using mockito for mocking the fields (which are services) in my classes.

I already have successfully use Spring and mockito.

Any idea how to do this?

Dimitri
  • 8,122
  • 19
  • 71
  • 128
  • Have you tried MockitoJunitRunner? – jhericks Aug 21 '15 at 01:07
  • Why can't you set the fields yourself? If you have annotated private fields that are not settable in the constructor and don't have setter methods, you can still set them via reflection (using getDeclaredField and setAccessible) as described here: [link](http://stackoverflow.com/questions/34571/how-to-test-a-class-that-has-private-methods-fields-or-inner-classes) – aro_tech Aug 21 '15 at 08:30
  • Have you looked at [arquillian](http://arquillian.org/)? – James R. Perkins Aug 21 '15 at 15:58

0 Answers0