Mockito

1.@injectmocks can only be annotated on the implementation class?

2. I would like to ask, one of my implementation classes called a lot of different services, using spring annotation injection, if I only want to mock individual services, what should I do? now after using @ injectmocks annotation, other services in the implementation class are null, can not use spring injection.

some people on the Internet say that if you annotate the implementation class with injectmocks and autowird together, you can try it, but it won"t work.

Mar.23,2021

I don't know if SpringBoot is used
if so, just MockBean to do the injection

.
Menu