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

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

## grails.test.mixin.web
[Groovy] Class FiltersUnitTestMixin

    java.lang.Object
      grails.test.mixin.support.GrailsUnitTestMixin
          grails.test.mixin.web.ControllerUnitTestMixin
              grails.test.mixin.web.FiltersUnitTestMixin

    class FiltersUnitTestMixin
    extends ControllerUnitTestMixin

A unit testing mixin to support the testing of Grails filter classes. This mixin provides a FiltersUnitTestMixin.mockFilters method to mock a filters class.

A typical usage pattern involves wrapping a call to controller in a call to the FiltersUnitTestMixin.withFilters method:

     def controller = mockController(MyController)
            mockFilters(MyFilters)
            withFilters(action:"list") {
                controller.list()
            }

Authors:
  Graeme Rocher

Since:
  2.0

Method Summary
`void` | `clearFilters()`
`CompositeInterceptor` | `getCompositeInterceptor()`
`CompositeInterceptor` | `mockFilters(java.lang.Class filterClass)` Mocks a filter class
`static void` | `setupFilterBeans()`
`java.lang.Object` | `withFilters(java.util.Map arguments, groovy.lang.Closure callable)` Wraps a call to controller in filter execution

Methods inherited from class ControllerUnitTestMixin
bindGrailsWebRequest, cleanupGrailsWeb, clearGrailsWebRequest, configureGrailsWeb, createAndEnhance, getFlash, getModel, getParams, getSession, getStatus, getView, mockCommandObject, mockController, testFor

Methods inherited from class GrailsUnitTestMixin
cleanupModifiedMetaClasses, defineBeans, deregisterMetaClassCleaner, initGrailsApplication, mockCodec, mockFor, mockForConstraintsTests, registerBeans, registerMetaClassRegistryWatcher, resetGrailsApplication, shouldFail, shouldFail, shutdownApplicationContext

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()

Method Detail

### clearFilters

    @org.junit.After
    void clearFilters()

### getCompositeInterceptor

    CompositeInterceptor getCompositeInterceptor()

### mockFilters

    CompositeInterceptor mockFilters(java.lang.Class filterClass)

  Mocks a filter class
  Parameters:
    `filterClass` - The filter class
  Returns:

### setupFilterBeans

    @org.junit.BeforeClass
    static void setupFilterBeans()

### withFilters

    java.lang.Object withFilters(java.util.Map arguments, groovy.lang.Closure callable)

  Wraps a call to controller in filter execution
  Parameters:
    `arguments` - Named arguments to specify the 'controller' and 'action' to map to
    `callable` - The closure code that invokes the controller action
  Returns:

Groovy Documentation