Help - Unit Testing with @Autowired private fields - most concise way ?
I have a class that I want to unit test. The class hasa n autowired PRIVATE member. This member is a service that does some db calls etc.
I'm writing a unit test and obviously want to mock the autowired/injected member (using mockito).
But, how do I plugin the mock into the class I want to test ?
Obviously I can right a setter (hate polluting with silly code though) or I can just make the member 'package private' and simple set it directly from the test, but I would like to avoid this as it will show up as a violation on our static code analysis report (sonar)
any ideas ?