InterceptorUnitTestMixin (Grails 3.2.7)
Date: 2017-03-06

Package: grails.test.mixin.web

## [Groovy] Class InterceptorUnitTestMixin

- grails.test.mixin.web.InterceptorUnitTestMixin

- A unit test mixin for Interceptor instances

  Authors:
    Graeme Rocher
  Since:
    3.0

- - ### Constructor Summary

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

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `protected GrailsInterceptorHandlerInterceptorAdapter` | `getHandlerInterceptor()`
    `Interceptor` | `mockInterceptor(java.lang.Class<? extends groovy.lang.Interceptor> interceptorClass)` Mock the interceptor for the given name
    `java.lang.Object` | `withInterceptors(java.util.Map<java.lang.String, java.lang.Object> arguments, groovy.lang.Closure callable)` Execute the given request with the registered interceptors
    `UrlMappingInfo` | `withRequest(java.util.Map<java.lang.String, java.lang.Object> arguments)` Allows testing of the interceptor directly by setting up an incoming request that can be matched prior to invoking the interceptor

  - ### 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, 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#getMetaClass(), groovy.lang.GroovyObjectSupport#setMetaClass(groovy.lang.MetaClass), groovy.lang.GroovyObjectSupport#invokeMethod(java.lang.String, java.lang.Object), 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

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

    - #### InterceptorUnitTestMixin()

  - ### Method Detail

    - #### protected GrailsInterceptorHandlerInterceptorAdapter getHandlerInterceptor()

    - #### @groovy.transform.CompileDynamic Interceptor mockInterceptor(java.lang.Class<? extends groovy.lang.Interceptor> interceptorClass)

      Mock the interceptor for the given name

      Parameters:
        `interceptorClass` - The interceptor class
      Returns:
        The mocked interceptor

    - #### java.lang.Object withInterceptors(java.util.Map<java.lang.String, java.lang.Object> arguments, groovy.lang.Closure callable)

      Execute the given request with the registered interceptors

      Parameters:
        `arguments` - The arguments
        `callable` - A callable containing an invocation of a controller action
      Returns:
        The result of the callable execution

    - #### @groovy.transform.CompileDynamic UrlMappingInfo withRequest(java.util.Map<java.lang.String, java.lang.Object> arguments)

      Allows testing of the interceptor directly by setting up an incoming request that can be matched prior to invoking the interceptor

      Parameters:
        `arguments` - Named arguments specifying the controller/action or URI that interceptor should match
      Returns:
        The UrlMappingInfo object