A base unit testing mixin that watches for MetaClass changes and unbinds them on tear down.
Constructor and description |
---|
GrailsUnitTestMixin
(java.util.Set<java.lang.String> features) |
GrailsUnitTestMixin
() |
Type Params | Return Type | Name and description |
---|---|---|
|
void |
defineBeans(boolean immediateDelivery = true, groovy.lang.Closure<?> closure) |
|
org.springframework.context.ConfigurableApplicationContext |
getApplicationContext() |
|
Config |
getConfig() |
|
GrailsApplication |
getGrailsApplication() |
|
org.springframework.context.ConfigurableApplicationContext |
getMainContext() |
|
org.springframework.context.MessageSource |
getMessageSource() |
|
void |
mockCodec(java.lang.Class<?> codecClass) Loads the given codec, adding the "encodeAs...()" and "decode...()" methods to objects. |
|
java.lang.String |
shouldFail(groovy.lang.Closure code) Asserts that the given code closure fails when it is evaluated |
|
java.lang.String |
shouldFail(java.lang.Class<?> clazz, groovy.lang.Closure code) Asserts that the given code closure fails when it is evaluated and that a particular exception is thrown. |
Methods inherited from class | Name |
---|---|
class TestMixinRuntimeSupport |
getFeatures, getRuntime, setRuntime, setTestClass |
class groovy.lang.GroovyObjectSupport |
groovy.lang.GroovyObjectSupport#getMetaClass(), groovy.lang.GroovyObjectSupport#setMetaClass(groovy.lang.MetaClass), groovy.lang.GroovyObjectSupport#invokeMethod(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#setProperty(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#getProperty(java.lang.String), groovy.lang.GroovyObjectSupport#wait(long, int), groovy.lang.GroovyObjectSupport#wait(long), groovy.lang.GroovyObjectSupport#wait(), groovy.lang.GroovyObjectSupport#equals(java.lang.Object), groovy.lang.GroovyObjectSupport#toString(), groovy.lang.GroovyObjectSupport#hashCode(), groovy.lang.GroovyObjectSupport#getClass(), groovy.lang.GroovyObjectSupport#notify(), groovy.lang.GroovyObjectSupport#notifyAll() |
Loads the given codec, adding the "encodeAs...()" and "decode...()" methods to objects.
codecClass
- The codec to load, e.g. HTMLCodec.Asserts that the given code closure fails when it is evaluated
Asserts that the given code closure fails when it is evaluated and that a particular exception is thrown.
clazz
- the class of the expected exceptioncode
- the closure that should fail