鉴于此映射:
"/student/degree/$studentid/$degreecode"(controller:'student', action:'degree')
我正在尝试下面的测试,但都失败了,AssertionFailedError: '...did not match any mapping'
而且都是有效的有效 URL。我可以使用仅“/student/degree”的测试 URL 成功,我认为由于需要参数而应该失败。
似乎这些assertURL
方法没有处理多个参数。这是否仅适用于“id”并且无法为这些 URL 创建测试?
@TestFor(UrlMappings)
@Mock([StudentController])
class UrlMappingsTests {
void testUrlMappings() {
assertForwardUrlMapping("/student/degree/102345678/N", controller: "student", action: "degree") {
assertForwardUrlMapping("/student/degree/102345678/N", controller: "student", action: "degree") {
studentid = 102345678
degreecode = "N"
}
}
}
}