|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovy.lang.GroovyObjectSupport groovy.lang.Closure grails.test.AbstractClosureProxy grails.test.MockClosureProxy
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.
Field Summary |
---|
Fields inherited from class groovy.lang.Closure | |
---|---|
OWNER_FIRST, DELEGATE_FIRST, OWNER_ONLY, DELEGATE_ONLY, TO_SELF, DONE, SKIP, IDENTITY |
Constructor Summary | |
MockClosureProxy(groovy.lang.Closure target, java.lang.String methodName, java.lang.Object expectation)
Constructor. |
Method Summary | |
---|---|
protected groovy.lang.Closure
|
createWrapper(groovy.lang.Closure c)
Creates a new |
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
|
Methods inherited from class AbstractClosureProxy | |
---|---|
asWritable, call, createWrapper, curry, doAfterCall, doBeforeCall, equals, getDelegate, getDirective, getMaximumNumberOfParameters, getParameterTypes, getProperty, getResolveStrategy, hashCode, isCase, setDelegate, setDirective, setProperty, setResolveStrategy |
Methods inherited from class groovy.lang.Closure | |
---|---|
groovy.lang.Closure#setDelegate(java.lang.Object), groovy.lang.Closure#call([Ljava.lang.Object;), groovy.lang.Closure#call(), groovy.lang.Closure#call(java.lang.Object), groovy.lang.Closure#setResolveStrategy(int), groovy.lang.Closure#getMaximumNumberOfParameters(), groovy.lang.Closure#getResolveStrategy(), groovy.lang.Closure#getThisObject(), groovy.lang.Closure#getDelegate(), groovy.lang.Closure#getDirective(), groovy.lang.Closure#setDirective(int), groovy.lang.Closure#isCase(java.lang.Object), groovy.lang.Closure#asWritable(), groovy.lang.Closure#curry(java.lang.Object), groovy.lang.Closure#curry([Ljava.lang.Object;), groovy.lang.Closure#rcurry(java.lang.Object), groovy.lang.Closure#rcurry([Ljava.lang.Object;), groovy.lang.Closure#ncurry(int, java.lang.Object), groovy.lang.Closure#ncurry(int, [Ljava.lang.Object;), groovy.lang.Closure#rightShift(groovy.lang.Closure), groovy.lang.Closure#leftShift(java.lang.Object), groovy.lang.Closure#leftShift(groovy.lang.Closure), groovy.lang.Closure#memoize(), groovy.lang.Closure#memoizeAtMost(int), groovy.lang.Closure#memoizeAtLeast(int), groovy.lang.Closure#memoizeBetween(int, int), groovy.lang.Closure#trampoline([Ljava.lang.Object;), groovy.lang.Closure#trampoline(), groovy.lang.Closure#dehydrate(), groovy.lang.Closure#rehydrate(java.lang.Object, java.lang.Object, java.lang.Object), groovy.lang.Closure#run(), groovy.lang.Closure#setProperty(java.lang.String, java.lang.Object), groovy.lang.Closure#getProperty(java.lang.String), groovy.lang.Closure#clone(), groovy.lang.Closure#getOwner(), groovy.lang.Closure#getParameterTypes(), groovy.lang.Closure#getMetaClass(), groovy.lang.Closure#setMetaClass(groovy.lang.MetaClass), groovy.lang.Closure#invokeMethod(java.lang.String, java.lang.Object), groovy.lang.Closure#wait(), groovy.lang.Closure#wait(long, int), groovy.lang.Closure#wait(long), groovy.lang.Closure#equals(java.lang.Object), groovy.lang.Closure#toString(), groovy.lang.Closure#hashCode(), groovy.lang.Closure#getClass(), groovy.lang.Closure#notify(), groovy.lang.Closure#notifyAll() |
Constructor Detail |
---|
public MockClosureProxy(groovy.lang.Closure target, java.lang.String methodName, java.lang.Object expectation)
Method Detail |
---|
protected Closure> createWrapper(Closure> c) { protected groovy.lang.Closure createWrapper(groovy.lang.Closure c)
MockClosureProxy
wrapping the given
closure.
c
- The closure to wrap.
@Override protected void doAfterCall(java.lang.Object[] args)
args
- The arguments to the target closure.
@Override protected void doBeforeCall(java.lang.Object[] args)
methodName
.
args
- The arguments to the "method" (actually
the argumetns to the target closure invocation).
Groovy Documentation