Package org.jmock.core.stub
Class DefaultResultStub
- java.lang.Object
-
- org.jmock.core.stub.DefaultResultStub
-
- All Implemented Interfaces:
SelfDescribing
,Stub
public class DefaultResultStub extends java.lang.Object implements Stub
-
-
Constructor Summary
Constructors Constructor Description DefaultResultStub()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addResult(java.lang.Class resultType, java.lang.Object resultValue)
protected void
createDefaultResults()
java.lang.String
createErrorMessage(Invocation call)
java.lang.StringBuffer
describeTo(java.lang.StringBuffer buf)
Appends the description of this object to the buffer.java.lang.Object
invoke(Invocation invocation)
Processes the invocation.
-
-
-
Method Detail
-
describeTo
public java.lang.StringBuffer describeTo(java.lang.StringBuffer buf)
Description copied from interface:SelfDescribing
Appends the description of this object to the buffer.- Specified by:
describeTo
in interfaceSelfDescribing
- Parameters:
buf
- The buffer that the description is appended to.- Returns:
- The buffer passed to the invokedMethod.
-
addResult
public void addResult(java.lang.Class resultType, java.lang.Object resultValue)
-
invoke
public java.lang.Object invoke(Invocation invocation) throws java.lang.Throwable
Description copied from interface:Stub
Processes the invocation.- Specified by:
invoke
in interfaceStub
- Parameters:
invocation
- The invocation to stub.- Returns:
- The result of the invocation, if not throwing an exception.
Must return
null
if the invocation is of a invokedMethod with a void return type. - Throws:
java.lang.Throwable
- An exception to be thrown to the caller, if not returning a value. A checked exception thrown from this invokedMethod must be in thethrows
list of the invoked method.
-
createErrorMessage
public java.lang.String createErrorMessage(Invocation call)
-
createDefaultResults
protected void createDefaultResults()
-
-