Код: Выделить всё
public void underTest(MyClass obj, int num) {
String arg = "";
if (obj.conditionIsTrue(num)) {
arg = "foo";
} else {
arg = "bar";
}
StaticClass.staticMethod(arg);
}
Код: Выделить всё
@Mock private MyClass mockObject;
@Captor ArgumentCaptor captor;
@Test
public void Test1() {
underTest(mockObject, 1);
verify(mockObject).conditionIsTrue(captor.capture());
assertEquals(1, captor.getValue());
}
Подробнее здесь: https://stackoverflow.com/questions/526 ... tic-method
Мобильная версия