UrlMappingsUnitTestMixin (Grails 3.2.8)
Date: 2017-03-23

Package: grails.test.mixin.web

## [Groovy] Class UrlMappingsUnitTestMixin

- grails.test.mixin.web.UrlMappingsUnitTestMixin

- A mixin for testing URL mappings in Grails.

  Authors:
    Luke Daley
    Graeme Rocher
  Since:
    2.0

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static java.lang.String` | `KEY_EXCEPTION` |

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `void` | `assertAction(java.lang.Object controller, java.lang.Object action, java.lang.Object url)` Asserts an action exists for the specified controller name, action name and url
    `` | `void` | `assertController(java.lang.Object controller, java.lang.Object url)` asserts a controller exists for the specified name and url
    `` | `void` | `assertForwardUrlMapping(java.lang.Object assertions, java.lang.Object url)`
    `` | `void` | `assertForwardUrlMapping(java.lang.Object assertions, java.lang.Object url, java.lang.Object paramAssertions)`
    `` | `void` | `assertReverseUrlMapping(java.util.Map assertions, java.lang.Object url)` Asserts the given controller and action produce the given reverse URL mapping
    `` | `void` | `assertReverseUrlMapping(java.util.Map assertions, java.lang.Object url, groovy.lang.Closure paramAssertions)` Asserts the given controller and action produce the given reverse URL mapping
    `` | `void` | `assertUrlMapping(java.util.Map assertions, java.lang.Object url)` Asserts a URL mapping maps to the controller and action specified by named parameters.
    `` | `void` | `assertUrlMapping(java.util.Map assertions, java.lang.Object url, groovy.lang.Closure paramAssertions)` Asserts a URL mapping maps to the controller and action specified by named parameters.
    `` | `void` | `assertView(java.lang.Object controller, java.lang.Object view, java.lang.Object url)` Asserts a view exists for the specified controller name, view name and url
    `` | `UrlMappingsHolder` | `getUrlMappingsHolder()` @return The UrlMappingsHolder bean
    `` | `java.lang.Object` | `mapURI(java.lang.String uri)` Maps a URI and returns the appropriate controller instance
    `` | `UrlMappingsHolder` | `mockUrlMappings(java.lang.Class urlMappingsClass)` Mocks specific URL mappings class

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

- - ### Field Detail

    - #### public static final java.lang.String KEY_EXCEPTION

  - ### Method Detail

    - #### void assertAction(java.lang.Object controller, java.lang.Object action, java.lang.Object url)

      Asserts an action exists for the specified controller name, action name and url

      Parameters:
        `controller` - The controller name
        `action` - The action name
        `url` - The URL

    - #### void assertController(java.lang.Object controller, java.lang.Object url)

      asserts a controller exists for the specified name and url

      Parameters:
        `controller` - The controller name
        `url` - The url

    - #### void assertForwardUrlMapping(java.lang.Object assertions, java.lang.Object url)

    - #### void assertForwardUrlMapping(java.lang.Object assertions, java.lang.Object url, java.lang.Object paramAssertions)

    - #### void assertReverseUrlMapping(java.util.Map assertions, java.lang.Object url)

      Asserts the given controller and action produce the given reverse URL mapping

                     assertReverseUrlMapping("/action1", controller: "grailsUrlMappingsTestCaseFake", action: "action1")

      Parameters:
        `assertions` - The assertions as named parameters
        `url` - The URL as a string

    - #### void assertReverseUrlMapping(java.util.Map assertions, java.lang.Object url, groovy.lang.Closure paramAssertions)

      Asserts the given controller and action produce the given reverse URL mapping

                     assertReverseUrlMapping("/action1", controller: "grailsUrlMappingsTestCaseFake", action: "action1")

      Parameters:
        `assertions` - The assertions as named parameters
        `url` - The URL as a string
        `paramAssertions` - The parameters to assert defined in the body of the closure

    - #### void assertUrlMapping(java.util.Map assertions, java.lang.Object url)

      Asserts a URL mapping maps to the controller and action specified by named parameters. Example:

                     assertUrlMapping("/action1", controller: "grailsUrlMappingsTestCaseFake", action: "action1")

      Parameters:
        `assertions` - The assertions as named parameters
        `url` - The URL as a string

    - #### void assertUrlMapping(java.util.Map assertions, java.lang.Object url, groovy.lang.Closure paramAssertions)

      Asserts a URL mapping maps to the controller and action specified by named parameters. Example:

                     assertUrlMapping("/action1", controller: "grailsUrlMappingsTestCaseFake", action: "action1")

      Parameters:
        `assertions` - The assertions as named parameters
        `url` - The URL as a string
        `paramAssertions` - The parameters to assert defined in the body of the closure

    - #### void assertView(java.lang.Object controller, java.lang.Object view, java.lang.Object url)

      Asserts a view exists for the specified controller name, view name and url

      Parameters:
        `controller` - The controller name
        `view` - The view name
        `url` - The url

    - #### UrlMappingsHolder getUrlMappingsHolder()

      Returns:
        The UrlMappingsHolder bean

    - #### java.lang.Object mapURI(java.lang.String uri)

      Maps a URI and returns the appropriate controller instance

      Parameters:
        `uri` - The URI to map
      Returns:
        The controller instance

    - #### UrlMappingsHolder mockUrlMappings(java.lang.Class urlMappingsClass)

      Mocks specific URL mappings class

      Parameters:
        `urlMappingsClass` - The URL mappings class to mock
      Returns:
        The UrlMappingsHolder class