@Trait trait UrlMappingsUnitTest<T> extends Object implements GrailsWebUnitTest, ParameterizedGrailsUnitTest<T>
Modifiers | Name | Description |
---|---|---|
static String |
KEY_EXCEPTION |
Type Params | Return Type | Name and description |
---|---|---|
|
void |
assertAction(String controller, String action) Asserts an action exists for the specified controller name, action name and url |
|
void |
assertController(String controller) asserts a controller exists for the specified name and url |
|
void |
assertForwardUrlMapping(Map<String, Object> assertions, Object url, Closure paramAssertions) |
|
void |
assertReverseUrlMapping(Map<String, String> assertions, String url, Closure paramAssertions) Asserts the given controller and action produce the given reverse URL mapping |
|
void |
assertUrlMapping(Map<String, String> assertions, String url, Closure paramAssertions) Asserts a URL mapping maps to the specified controller, action, and optionally also parameters. |
|
void |
assertView(String controller, String view) Asserts a view exists for the specified controller name and view name |
|
void |
configuredMockedControllers() |
|
String |
getBeanName(Class<?> urlMappingsClass) |
|
GrailsControllerClass |
getControllerClass(String controller) |
|
Class[] |
getControllersToMock() |
|
UrlMappingsHolder |
getUrlMappingsHolder()
|
|
Object |
mapURI(String uri) Maps a URI and returns the appropriate controller instance |
|
void |
mockArtefact(Class<?> urlMappingsClass) |
|
boolean |
verifyAction(String controller, String action)
|
|
boolean |
verifyController(String controller)
|
|
boolean |
verifyForwardUrlMapping(Map<String, Object> assertions, Object url, Closure paramAssertions) |
|
boolean |
verifyReverseUrlMapping(Map<String, String> assertions, String url, Closure paramAssertions) Asserts the given controller and action produce the given reverse URL mapping |
|
boolean |
verifyUrlMapping(Map<String, String> assertions, String url, Closure paramAssertions) Verifies a URL mapping maps to the specified controller, action, and optionally also parameters. |
|
boolean |
verifyView(String controller, String view)
|
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
Maps a URI and returns the appropriate controller instance
uri
- The URI to map
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