如何将私有字段注入测试对象?

How to inject private field into tested object?

我关注class:

public class TestedClass{
   private List<String> strings;
   .... 
}

测试:

public class TestedClassTest{

  @Spy
  TestedClass testedClass = new TestedClass();

}

我知道存在注释 @InjectMocks 但它仅适用于模拟,但我想注入真实的 List

P.S.

名单还没有setter。在实际代码中 setter 是多余的。

public class TestedClassTest{
  @Spy
  private List<String> strings;

  @Spy
  @InjectMocks
  TestedClass testedClass = new TestedClass();

}