public class MockClosureProxy extends AbstractClosureProxy
This closure proxy stores an expectation and checks it before each call to the target closure. It is used by the Grails mocking framework.
| Modifiers | Name | Description |
|---|---|---|
java.lang.Object |
expectation |
|
java.lang.String |
methodName |
|
private static long |
serialVersionUID |
| Fields inherited from class | Fields |
|---|---|
class AbstractClosureProxy |
target |
| Constructor and description |
|---|
MockClosureProxy
(groovy.lang.Closure<?> target, java.lang.String methodName, java.lang.Object expectation)Constructor. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected groovy.lang.Closure<?> |
createWrapper(groovy.lang.Closure<?> c)Creates a new MockClosureProxy wrapping the given
closure. |
|
protected void |
doAfterCall(java.lang.Object[] args)Empty implementation. |
|
protected void |
doBeforeCall(java.lang.Object[] args)Checks whether the target "method" is expected or not, on the basis that this closure is mocking a method with the name methodName. |
| Methods inherited from class | Name |
|---|---|
class AbstractClosureProxy |
asWritable, call, createWrapper, curry, doAfterCall, doBeforeCall, equals, getDelegate, getDirective, getMaximumNumberOfParameters, getParameterTypes, getProperty, getResolveStrategy, hashCode, isCase, setDelegate, setDirective, setProperty, setResolveStrategy |
Constructor.
Creates a new MockClosureProxy wrapping the given
closure.
c - The closure to wrap.Empty implementation.
args - The arguments to the target closure. Checks whether the target "method" is expected or not, on the
basis that this closure is mocking a method with the name
methodName.
args - The arguments to the "method" (actually
the argumetns to the target closure invocation).