YushanGao opened SPR-16355 and commented

When write a unit test case for a service, we have to write code like this to mock every depend services:

ReflectionTestUtils.setField(targetService, "dependService1", dependService1Mock); ReflectionTestUtils.setField(targetService, "dependService2", dependService2Mock); ReflectionTestUtils.setField(targetService, "dependService3", dependService3Mock); ....

There will be many code like this in a complex service, we need an easy way to replace this code.


Referenced from: pull request https://github.com/spring-projects/spring-framework/pull/1613

Comment From: sbrannen

  • Superseded by #1613