Skip to content

Commit cf0531b

Browse files
author
Joe McCall
committed
Check for exception in the forward url mapping assertion
Fixes #10226
1 parent b5eb7f6 commit cf0531b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

grails-plugin-testing/src/main/groovy/grails/test/mixin/web/UrlMappingsUnitTestMixin.groovy

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import org.grails.gsp.GroovyPagesTemplateEngine
3939
*/
4040
class UrlMappingsUnitTestMixin extends ControllerUnitTestMixin {
4141

42+
public static final String KEY_EXCEPTION = 'exception'
4243
private assertionKeys = ["controller", "action", "view"]
4344

4445
/**
@@ -193,7 +194,12 @@ class UrlMappingsUnitTestMixin extends ControllerUnitTestMixin {
193194
def mappingInfos
194195
if (url instanceof Integer) {
195196
mappingInfos = []
196-
def mapping = mappingsHolder.matchStatusCode(url)
197+
def mapping
198+
if (assertions."$KEY_EXCEPTION") {
199+
mapping = mappingsHolder.matchStatusCode(url, assertions."$KEY_EXCEPTION" as Throwable)
200+
} else {
201+
mapping = mappingsHolder.matchStatusCode(url)
202+
}
197203
if (mapping) mappingInfos << mapping
198204
}
199205
else {

0 commit comments

Comments
 (0)