Моя проблема заключается в издевательстве и тестировании метода, который создает экземпляры других классов и вызывает их метод. В целях безопасности проекта я только не буду вдаваться в подробности. Тестируемый метод — это метод launch() класса A. Спецификации теста хотели, чтобы b.methodOfB возвращал значение null. другая тестовая спецификация будет для метода c.getinput() возвращать null
public class A{
public static void launch()
{
//instantiation of other classes that will be used
B b = new B();
C c = new C();
//class C has a method that gets user information from the console and returns a string
//i would like to mock c.getinput() to return null
while (c.getinput().compareToIgnoreCase("q") != 0) {
//would also like to mock the b.methodOfB() to return null for testing im having a hard time doing this
b.methodOfB();//returns something not null
}
}
}