@Trait @CompileStatic trait GrailsUnitTest extends java.lang.Object
| Type Params | Return Type | Name and description |
|---|---|---|
|
BeanRegistrar |
beanRegistrar()Registers beans in the test application context, the way an application's or a plugin's beanRegistrar() does at boot and at the same point: after doWithSpring(), so a
registrar bean wins a name conflict with the deprecated DSL. |
|
void |
cleanupGrailsApplication() |
|
void |
defineBeans(Closure closure) |
|
void |
defineBeans(BeanRegistrar registrar)Applies a BeanRegistrar to the test application context, the same way a plugin's beanRegistrar() hook is applied by the framework at boot time. |
|
void |
defineBeans(java.lang.Object plugin)Applies a plugin's doWithSpring() and beanRegistrar() to the test application
context. |
|
Closure |
doWithConfig() |
|
Closure |
doWithSpring()Beans for the test application context in the bean builder DSL. |
|
ConfigurableApplicationContext |
getApplicationContext()
|
|
Config |
getConfig()
|
|
java.util.Set<java.lang.Class<?>> |
getConfigurationClasses()Configuration classes for the test application context. |
|
GrailsApplication |
getGrailsApplication()
|
|
java.util.Set<java.lang.String> |
getIncludePlugins() |
|
boolean |
getLocalOverride() |
|
MessageSource |
getMessageSource()
|
|
java.lang.Object |
getOptionalServletContext()
|
|
boolean |
loadExternalBeans() |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
Registers beans in the test application context, the way an application's or a plugin's
beanRegistrar() does at boot and at the same point: after doWithSpring(), so a
registrar bean wins a name conflict with the deprecated DSL.
null (the default) to register nothing Applies a BeanRegistrar to the test application context, the same way a plugin's
beanRegistrar() hook is applied by the framework at boot time.
Applies a plugin's doWithSpring() and beanRegistrar() to the test application
context. A plugin's beans block is not among them: it compiles to an auto-configuration,
which is registered before the context refreshes - include the plugin through
getIncludePlugins() for that.
Beans for the test application context in the bean builder DSL.
doWithSpring() is on plugins and applications, in favour of a
beans block, beanRegistrar() or a configuration class (see
getConfigurationClasses()). The DSL keeps working but receives no fixes for new issues.
Configuration classes for the test application context. They are registered ahead of the
framework's auto-configurations, as an application's own configuration is, so an
auto-configuration's @ConditionalOnMissingBean backs off from the beans they declare.
By default, the static nested classes of the test, and of any test it extends, annotated
@Configuration directly or through another annotation such as @AutoConfiguration
- the convention Spring's own test support follows. A test's beans block compiles into
one of them, BeansConfiguration. Override to register other classes instead.