FiltersUnitTestMixin (Grails 2.4.4)
Date: 2014-10-28

Package: grails.test.mixin.web

## [Groovy] Class FiltersUnitTestMixin

- grails.test.mixin.web.FiltersUnitTestMixin

- 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

- - ### Constructor Summary

    Constructors
    Constructor and description
    `FiltersUnitTestMixin (java.util.Set<java.lang.String> features)`
    `FiltersUnitTestMixin ()`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `CompositeInterceptor` | `getCompositeInterceptor()`
    `CompositeInterceptor` | `mockFilters(java.lang.Class filterClass)` Mocks a filter class
    `java.lang.Object` | `withFilters(java.util.Map arguments, groovy.lang.Closure callable)` Wraps a call to controller in filter execution

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class ControllerUnitTestMixin` | `createAndEnhance, getFlash, getGroovyPages, getModel, getParams, getRequest, getResponse, getServletContext, getSession, getStatus, getView, getViews, getWebRequest, mockCommandObject, mockController, testFor`
    `class GrailsUnitTestMixin` | `defineBeans, getApplicationContext, getConfig, getGrailsApplication, getMainContext, getMessageSource, mockCodec, mockFor, mockForConstraintsTests, shouldFail, shouldFail`
    `class TestMixinRuntimeSupport` | `getFeatures, getRuntime, setRuntime, setTestClass`
    `class groovy.lang.GroovyObjectSupport` | `groovy.lang.GroovyObjectSupport#setProperty(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#getProperty(java.lang.String), groovy.lang.GroovyObjectSupport#invokeMethod(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#setMetaClass(groovy.lang.MetaClass), groovy.lang.GroovyObjectSupport#getMetaClass(), 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()`

- - ### Constructor Detail

    - #### FiltersUnitTestMixin(java.util.Set<java.lang.String> features)

    - #### FiltersUnitTestMixin()

  - ### Method Detail

    - #### CompositeInterceptor getCompositeInterceptor()

    - #### CompositeInterceptor mockFilters(java.lang.Class filterClass)

      Mocks a filter class

      Parameters:
        `filterClass` - The filter class
      Returns:

    - #### 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: