eg. let's say I have this class:
public class Foo Implements Fooable {
public void a() {
bar = b();
}
public Bar b() {
}
}
And I want to test Foo.a. I want to make fun Foo.b, because I am testing this method separately. What I present looks something like this:
public class FooTest extends TestCase {
public void testA() {
Fooable foo = createPartialMock(
Fooable.class,
Foo
);
expect(foo.b()).andReturn(new Bar());
replay(foo);
foo.a();
verify(foo);
}
}
I know that I can write my own subclass Footo do this for me. But I do not want to do this if I do not need it, because it is tiring, that is, to automate.
source
share