i have a bean like this one
@Service
public class SpringParent {
@Resource
SpringChild sc;
public String giveChild() {
return sc.giveChild();
}
}
and a test class like this one..
public class InjectMock3 {
@Spy
SpringParent sp;
@Test
public void test() {
sp.giveChild();
verify(sp).giveChild();
}
}
then a message like
Cannot invoke "com.coussy.SpringChild.giveChild()" because sc is null
So, my question/thinking is : is it the moment to replace @Spy by @SpyBean or is there another method ?