|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD |
java.lang.Object grails.test.mixin.support.GrailsUnitTestMixin
class GrailsUnitTestMixin extends java.lang.Object
A base unit testing mixin that watches for MetaClass changes and unbinds them on tear down.
Property Summary | |
---|---|
static GrailsWebApplicationContext |
applicationContext
|
static groovy.util.ConfigObject |
config
|
static GrailsApplication |
grailsApplication
|
java.util.Set |
loadedCodecs
|
static org.springframework.context.MessageSource |
messageSource
|
java.util.Map |
validationErrorsMap
|
Method Summary | |
---|---|
static void
|
cleanupModifiedMetaClasses()
|
static void
|
defineBeans(groovy.lang.Closure callable)
|
static void
|
deregisterMetaClassCleaner()
|
static void
|
initGrailsApplication()
|
void
|
mockCodec(java.lang.Class codecClass)
Loads the given codec, adding the "encodeAs...()" and "decode...()" methods to objects. |
GrailsMock
|
mockFor(java.lang.Class clazz, boolean loose = false)
Creates a new Grails mock for the given class. |
void
|
mockForConstraintsTests(java.lang.Class clazz, java.util.List instances = [])
Mocks the given class (either a domain class or a command object) so that a "validate()" method is added. |
static void
|
registerMetaClassRegistryWatcher()
|
void
|
resetGrailsApplication()
|
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. |
static void
|
shutdownApplicationContext()
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Property Detail |
---|
static GrailsWebApplicationContext applicationContext
static groovy.util.ConfigObject config
static GrailsApplication grailsApplication
java.util.Set loadedCodecs
static org.springframework.context.MessageSource messageSource
java.util.Map validationErrorsMap
Method Detail |
---|
static void cleanupModifiedMetaClasses()
static void defineBeans(groovy.lang.Closure callable)
@AfterClass static void deregisterMetaClassCleaner()
@BeforeClass static void initGrailsApplication()
void mockCodec(java.lang.Class codecClass)
codecClass
- The codec to load, e.g. HTMLCodec.
GrailsMock mockFor(java.lang.Class clazz, boolean loose = false)
clazz
- The class to mock.loose
- If true
, the method returns a loose-
expectation mock, otherwise it returns a strict one. The default
is a strict mock.
void mockForConstraintsTests(java.lang.Class clazz, java.util.List instances = [])
static void registerMetaClassRegistryWatcher()
@After void resetGrailsApplication()
java.lang.String shouldFail(groovy.lang.Closure code)
java.lang.String shouldFail(java.lang.Class clazz, groovy.lang.Closure code)
clazz
- the class of the expected exceptioncode
- the closure that should fail
@AfterClass static void shutdownApplicationContext()
Groovy Documentation