【发布时间】:2012-06-09 08:53:13
【问题描述】:
是否可以模拟 Java 类的单个方法?
例如:
class A {
long method1();
String method2();
int method3();
}
// in some other class
class B {
void someMethod(A a) {
// how would I mock A.method1(...) such that a.method1() returns a value of my
// choosing;
// whilst leaving a.method2() and a.method3() untouched.
}
}
【问题讨论】: