jeudi 5 février 2015

Grails 2.2.2 UrlMappings testing with exceptions

Is it possible to implement unit test against such url mapping?



"500" (controller: 'error', action: 'handle', exception: MyCustomException)


I've tried to write such unit test



@TestFor(UrlMappings)
@Mock(ErrorController)
class UrlMappingsTest {

void test() {
assertForwardUrlMapping(500, controller: "error", action: "handle", exception: MyCustomException)


}

}


but got junit.framework.AssertionFailedError: url '500' did not match any mappings


If I remove exception: MyCustomException from UrlMapping.groovy and from unit test it works. But I cannot do it.


Aucun commentaire:

Enregistrer un commentaire