2 * @author Graeme Rocher
7 package org
.codehaus
.groovy
.grails
.web
.mapping
9 import org
.springframework
.core
.io
.ByteArrayResource
10 import org
.codehaus
.groovy
.grails
.web
.servlet
.mvc
.AbstractGrailsControllerTests
12 class UrlMappingWithCustomValidatorTests
extends AbstractGrailsControllerTests
{
13 def topLevelMapping
= '''
15 "/help/$path**"(controller : "wiki", action : "show", id : "1") {
17 path(validator : { val, obj -> ! val.startsWith("js") })
22 def UrlMappingsHolder holder
27 def res
= new ByteArrayResource(topLevelMapping
.bytes
)
29 def evaluator
= new DefaultUrlMappingEvaluator()
30 def mappings
= evaluator
.evaluateMappings(res
)
32 holder
= new DefaultUrlMappingsHolder(mappings
)
35 void testMatchWithCustomValidator() {
36 def info
= holder
.match("/help/foo.html")
40 info
= holder
.match("/help/js/foo.js")