jeudi 5 février 2015

How to inject private field into spy?

I have following class:



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


Test:



public class TestedClassTest{

@Spy
TestedClass testedClass = new TestedClass();

}


I know that exists annotation @InjectMocks but it works only for mocks but I want to inject real List


P.S.


List have not setter. In real code setter is redundant.


Aucun commentaire:

Enregistrer un commentaire