org.jmock.core.stub
Class CustomStub
- SelfDescribing, Stub
public abstract class CustomStub
A partial implementation of the Stub interface that makes it convenient to implement
application-specific stubs with inline anonymous classes:
final String name = "NAME";
final StringBuffer buffer = new StringBuffer();
mock.expect("describeTo", C.args(C.same(buffer))), new CustomStub("appends name to buffer") {
public Object invoke( Invocation invocation ) throws Throwable {
return buffer.append(name);
}
} );
StringBuffer | describeTo(StringBuffer buffer) - Appends the description of this object to the buffer.
|
CustomStub
public CustomStub(String description)
describeTo
public StringBuffer describeTo(StringBuffer buffer)
Appends the description of this object to the buffer.
- describeTo in interface SelfDescribing
buffer
- The buffer that the description is appended to.
- The buffer passed to the invokedMethod.