@groovy.transform.Trait trait UrlMappingsUnitTest<T> extends java.lang.Object implements GrailsWebUnitTest, ParameterizedGrailsUnitTest<T>
| Modifiers | Name | Description |
|---|---|---|
static java.lang.String |
KEY_EXCEPTION |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
assertAction(java.lang.String controller, java.lang.String action)Asserts an action exists for the specified controller name, action name and url |
|
void |
assertController(java.lang.String controller)asserts a controller exists for the specified name and url |
|
void |
assertForwardUrlMapping(java.util.Map<java.lang.String, java.lang.Object> assertions, java.lang.Object url, groovy.lang.Closure paramAssertions) |
|
void |
assertReverseUrlMapping(java.util.Map<java.lang.String, java.lang.String> assertions, java.lang.String url, groovy.lang.Closure paramAssertions)Asserts the given controller and action produce the given reverse URL mapping |
|
void |
assertUrlMapping(java.util.Map<java.lang.String, java.lang.String> assertions, java.lang.String url, groovy.lang.Closure paramAssertions)Asserts a URL mapping maps to the specified controller, action, and optionally also parameters. |
|
void |
assertView(java.lang.String controller, java.lang.String view)Asserts a view exists for the specified controller name and view name |
|
void |
cleanupUrlMappingsAfterFeature()Clears any URL mapping artefacts registered by this spec so that subsequent specs in the same JVM start from a clean registry. |
|
void |
configuredMockedControllers() |
|
java.lang.String |
getBeanName(java.lang.Class<?> urlMappingsClass) |
|
GrailsControllerClass |
getControllerClass(java.lang.String controller) |
|
java.lang.Class[] |
getControllersToMock() |
|
UrlMappingsHolder |
getUrlMappingsHolder()
|
|
java.lang.Object |
mapURI(java.lang.String uri)Maps a URI and returns the appropriate controller instance |
|
void |
mockArtefact(java.lang.Class<?> urlMappingsClass) |
|
void |
resetUrlMappingsForFeature()Re-registers this spec's URL mappings and rebuilds the grailsUrlMappingsHolder
bean so each feature method starts with only this spec's mappings active. |
|
boolean |
verifyAction(java.lang.String controller, java.lang.String action)
|
|
boolean |
verifyController(java.lang.String controller)
|
|
boolean |
verifyForwardUrlMapping(java.util.Map<java.lang.String, java.lang.Object> assertions, java.lang.Object url, groovy.lang.Closure paramAssertions) |
|
boolean |
verifyReverseUrlMapping(java.util.Map<java.lang.String, java.lang.String> assertions, java.lang.String url, groovy.lang.Closure paramAssertions)Asserts the given controller and action produce the given reverse URL mapping |
|
boolean |
verifyUrlMapping(java.util.Map<java.lang.String, java.lang.String> assertions, java.lang.String url, groovy.lang.Closure paramAssertions)Verifies a URL mapping maps to the specified controller, action, and optionally also parameters. |
|
boolean |
verifyView(java.lang.String controller, java.lang.String view)
|
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
Asserts an action exists for the specified controller name, action name and url
controller - The controller nameaction - The action nameasserts a controller exists for the specified name and url
controller - The controller nameurl - The urlAsserts the given controller and action produce the given reverse URL mapping
assertReverseUrlMapping("/action1", controller: "grailsUrlMappingsTestCaseFake", action: "action1")
assertions - The assertions as named parametersurl - The URL as a stringparamAssertions - The parameters to assert defined in the body of the closureAsserts a URL mapping maps to the specified controller, action, and optionally also parameters. Example:
assertUrlMapping("/action1", controller: "grailsUrlMappingsTestCaseFake", action: "action1") {
param1 = "value1"
param2 = "value2"
}
assertions - The assertions as named parametersurl - The URL as a stringparamAssertions - The parameters to assert defined in the body of the closureAsserts a view exists for the specified controller name and view name
controller - The controller nameview - The view name Clears any URL mapping artefacts registered by this spec so that subsequent specs in
the same JVM start from a clean registry. The holder bean itself is left intact —
destroying it would leave linkGenerator (held by tag libraries) pointing at a
destroyed bean for any non-URL-mapping spec that runs next. The next
UrlMappingsUnitTest-based spec rebuilds the holder via mockArtefact.
Maps a URI and returns the appropriate controller instance
uri - The URI to map Re-registers this spec's URL mappings and rebuilds the grailsUrlMappingsHolder
bean so each feature method starts with only this spec's mappings active. Other specs
running in the same JVM may register their own mappings or clear the registry; calling
this restores the state expected by this spec.
controller - The controller nameaction - The action name
controller - The controller nameurl - The urlAsserts the given controller and action produce the given reverse URL mapping
verifyReverseUrlMapping("/action1", controller: "grailsUrlMappingsTestCaseFake", action: "action1")
assertions - The assertions as named parametersurl - The URL as a stringparamAssertions - The parameters to assert defined in the body of the closureVerifies a URL mapping maps to the specified controller, action, and optionally also parameters. Example:
verifyUrlMapping("/action1", controller: "grailsUrlMappingsTestCaseFake", action: "action1") {
param1 = "value1"
param2 = "value2"
}
assertions - The assertions as named parametersurl - The URL as a stringparamAssertions - The parameters to assert defined in the body of the closure
controller - The controller nameview - The view nameurl - The url