Closed GoogleCodeExporter closed 8 years ago
It seems that fields that are annotated with both @InjectMocks and @Spy are not
proxied on the first pass.
A list is built containing all the mocks that are available for injection,
including the original copy of the @InjectMocks&@Spy fields.
I think at this point the fields with @InjectMocks&@Spy are Proxied (the proxy
also seems to refer to a copy of the original field). But the list is not
updated with the proxied references.
Now all the mocks are injected based on the list, so the original fields are
injected, but the fields available to the unit test class are the Proxied
copies.
Original comment by james.a....@gmail.com
on 31 Aug 2012 at 1:45
Yes it was made this way. As mockito is trying to do things automatically. Some
combination don't work n edge case, such as the one you are using.
Mockito is not an injection framework, so I don't plan to work on what you are
asking. But you can clone a repo and improve the injection code.
Actually I would be more interested in allowing mockito injection stuff to be
easily extended by users.
Cheers,
Brice
Original comment by brice.du...@gmail.com
on 3 Sep 2012 at 9:51
Original comment by brice.du...@gmail.com
on 3 Sep 2012 at 9:56
Original comment by brice.du...@gmail.com
on 3 Sep 2012 at 10:00
Original issue reported on code.google.com by
james.a....@gmail.com
on 30 Aug 2012 at 3:28Attachments: