Как смоделировать один метод в java

Можно ли смоделировать один метод класса 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.
    }
}
30
задан auser 5 June 2012 в 10:26
поделиться