GrailsTestRequestEnvironmentInterceptor (Grails 2.3.8)
Date: 2014-04-24

Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD

## org.codehaus.groovy.grails.test.support
[Groovy] Class GrailsTestRequestEnvironmentInterceptor

    java.lang.Object
      org.codehaus.groovy.grails.test.support.GrailsTestRequestEnvironmentInterceptor

    class GrailsTestRequestEnvironmentInterceptor
    extends java.lang.Object

Establishes a “mock” request environment suitable for running tests in.

Property Summary
`static java.lang.String` | `DEFAULT_CONTROLLER_NAME`
`org.springframework.context.ApplicationContext` | `applicationContext`

Constructor Summary
`GrailsTestRequestEnvironmentInterceptor(org.springframework.context.ApplicationContext applicationContext)`

Method Summary
`void` | `destroy()` Removes the mock request environment
`void` | `doInRequestEnvironment(groovy.lang.Closure body)` Passes `body` to `doInRequestEnvironment(String,Closure)` with the `DEFAULT_CONTROLLER_NAME`.
`void` | `doInRequestEnvironment(java.lang.String controllerName, groovy.lang.Closure body)` Calls `init()` before and `destroy()` after invoking `body`.
`void` | `init(java.lang.String controllerName = DEFAULT_CONTROLLER_NAME)` Establishes a mock request environment

Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), 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

### DEFAULT_CONTROLLER_NAME

    static final java.lang.String DEFAULT_CONTROLLER_NAME

### applicationContext

    org.springframework.context.ApplicationContext applicationContext

Constructor Detail

### GrailsTestRequestEnvironmentInterceptor

    GrailsTestRequestEnvironmentInterceptor(org.springframework.context.ApplicationContext applicationContext)

Method Detail

### destroy

    void destroy()

  Removes the mock request environment

### doInRequestEnvironment

    void doInRequestEnvironment(groovy.lang.Closure body)

  Passes `body` to `doInRequestEnvironment(String,Closure)` with the `DEFAULT_CONTROLLER_NAME`.

### doInRequestEnvironment

    void doInRequestEnvironment(java.lang.String controllerName, groovy.lang.Closure body)

  Calls `init()` before and `destroy()` after invoking `body`.

### init

    void init(java.lang.String controllerName = DEFAULT_CONTROLLER_NAME)

  Establishes a mock request environment

Groovy Documentation