Package org.jmock.core
Class InvocationMocker
- java.lang.Object
-
- org.jmock.core.InvocationMocker
-
- All Implemented Interfaces:
Invokable
,SelfDescribing
,StubMatchersCollection
,Verifiable
public class InvocationMocker extends java.lang.Object implements Invokable, StubMatchersCollection
- Since:
- 1.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
InvocationMocker.Describer
-
Field Summary
Fields Modifier and Type Field Description static InvocationMocker.Describer
DEFAULT_DESCRIBER
-
Constructor Summary
Constructors Constructor Description InvocationMocker()
InvocationMocker(InvocationMocker.Describer describer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMatcher(InvocationMatcher matcher)
java.lang.StringBuffer
describeTo(java.lang.StringBuffer buffer)
Appends the description of this object to the buffer.boolean
hasDescription()
java.lang.Object
invoke(Invocation invocation)
boolean
matches(Invocation invocation)
void
setName(java.lang.String name)
void
setStub(Stub stub)
java.lang.String
toString()
void
verify()
Throw an AssertionFailedException if any expectations have not been met.
-
-
-
Field Detail
-
DEFAULT_DESCRIBER
public static final InvocationMocker.Describer DEFAULT_DESCRIBER
-
-
Constructor Detail
-
InvocationMocker
public InvocationMocker()
-
InvocationMocker
public InvocationMocker(InvocationMocker.Describer describer)
-
-
Method Detail
-
matches
public boolean matches(Invocation invocation)
-
invoke
public java.lang.Object invoke(Invocation invocation) throws java.lang.Throwable
-
verify
public void verify()
Description copied from interface:Verifiable
Throw an AssertionFailedException if any expectations have not been met. Implementations of this method must be idempotent: jMock can call this method more than once when verifying expectations at the end of a test.- Specified by:
verify
in interfaceVerifiable
-
setName
public void setName(java.lang.String name)
- Specified by:
setName
in interfaceStubMatchersCollection
-
addMatcher
public void addMatcher(InvocationMatcher matcher)
- Specified by:
addMatcher
in interfaceStubMatchersCollection
-
setStub
public void setStub(Stub stub)
- Specified by:
setStub
in interfaceStubMatchersCollection
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hasDescription
public boolean hasDescription()
- Specified by:
hasDescription
in interfaceInvokable
-
describeTo
public java.lang.StringBuffer describeTo(java.lang.StringBuffer buffer)
Description copied from interface:SelfDescribing
Appends the description of this object to the buffer.- Specified by:
describeTo
in interfaceSelfDescribing
- Parameters:
buffer
- The buffer that the description is appended to.- Returns:
- The buffer passed to the invokedMethod.
-
-