When using Mockito 1.9.x I have been using Whiteboxto set values of fields to \"inject\" mocks. Se example below:
Whitebox
@Before public void setUp() {
If you are using Spring (the spring-test library specifically), you can simply use ReflectionTestUtils.setField instead of Whitebox.setInternalState
ReflectionTestUtils.setField
Whitebox.setInternalState