Groovy Documentation

grails.test.mixin.web
[Groovy] Class UrlMappingsUnitTestMixin

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

class UrlMappingsUnitTestMixin
extends ControllerUnitTestMixin

A mixin for testing URL mappings in Grails.

Authors:
Luke Daley
Graeme Rocher
Since:
2.0


Method Summary
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 URl and returns the appropriate controller instance

UrlMappingsHolder mockUrlMappings(java.lang.Class urlMappingsClass)

Mocks specific URL mappings class

 
Methods inherited from class ControllerUnitTestMixin
bindGrailsWebRequest, cleanupGrailsWeb, clearGrailsWebRequest, configureGrailsWeb, getFlash, getModel, getParams, getSession, getView, mockCommandObject, mockController, testFor
 
Methods inherited from class GrailsUnitTestMixin
cleanupModifiedMetaClasses, defineBeans, deregisterMetaClassCleaner, initGrailsApplication, mockCodec, mockFor, mockForConstraintsTests, registerMetaClassRegistryWatcher, resetGrailsApplication, shouldFail, shouldFail, shutdownApplicationContext
 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), 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

assertAction

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


assertController

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


assertForwardUrlMapping

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


assertForwardUrlMapping

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


assertReverseUrlMapping

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


assertReverseUrlMapping

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


assertUrlMapping

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


assertUrlMapping

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


assertView

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


getUrlMappingsHolder

UrlMappingsHolder getUrlMappingsHolder()
Returns:
The UrlMappingsHolder bean


mapURI

java.lang.Object mapURI(java.lang.String uri)
Maps a URl and returns the appropriate controller instance
Parameters:
uri - The URI to map
Returns:
The controller instance


mockUrlMappings

UrlMappingsHolder mockUrlMappings(java.lang.Class urlMappingsClass)
Mocks specific URL mappings class
Parameters:
urlMappingsClass - The URL mappings class to mock
Returns:
The UrlMappingsHolder class


 

Groovy Documentation