def grailsUrlMappingsHolderBean
void testMappingForPersonController() {
def mappingInfo = grailsUrlMappingsHolderBean.match('/person/pain')
assertEquals 'person', mappingInfo.controllerName
assertEquals 'show', mappingInfo.actionName
assertEquals 'pain', mappingInfo.parameters.id
}
The grails testing plugin provides custom assertions for doing this and more (assertUrlMapping etc.).
kthxbye
Testing the other way is really important as well. It's easy to make changes to your url mappings that break <g:link controller='blah' action='foo'/> type links.
ReplyDelete