grails / grails-core

The Grails Web Application Framework
http://grails.org
Apache License 2.0
2.78k stars 950 forks source link

GRAILS-5812: Error with tests of controllers and messageSource #6841

Closed graemerocher closed 9 years ago

graemerocher commented 14 years ago

Original Reporter: lrgalego Environment: Not Specified Version: 1.2 final Migrated From: http://jira.grails.org/browse/GRAILS-5812

This problem is listed above: http://n4.nabble.com/Unit-Testing-the-injected-MessageSource-td1384363.html#a1384363

When you create a controller test that uses a controller with internacionalization, the test fails with the follow stack trace: No signature of method: MessageController.message() is applicable for argument types: (java.util.LinkedHashMap) values: [[code:default.not.found.message, args:[test, 1]]]

groovy.lang.MissingMethodException: No signature of method: MessageController.message() is applicable for argument types: (java.util.LinkedHashMap) values: [[code:default.not.found.message, args:[test, 1]]] at MessageController$_closure1.doCall(MessageController.groovy:4) at MessageController$_closure1.doCall(MessageController.groovy) at MessageControllerTests.testSomething(MessageControllerTests.groovy:18) at _GrailsTest_groovy$_run_closure4.doCall(_GrailsTest_groovy:262) at _GrailsTest_groovy$_run_closure4.call(_GrailsTest_groovy) at _GrailsTest_groovy$_run_closure2.doCall(_GrailsTest_groovy:221) at _GrailsTest_groovy$_run_closure1_closure21.doCall(_GrailsTest_groovy:181) at _GrailsTest_groovy$_run_closure1.doCall(_GrailsTest_groovy:168) at TestApp$_run_closure1.doCall(TestApp.groovy:102) at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324) at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334) at gant.Gant$_dispatch_closure6.doCall(Gant.groovy) at gant.Gant.withBuildListeners(Gant.groovy:344) at gant.Gant.this$2$withBuildListeners(Gant.groovy) at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source) at gant.Gant.dispatch(Gant.groovy:334) at gant.Gant.this$2$dispatch(Gant.groovy) at gant.Gant.invokeMethod(Gant.groovy) at gant.Gant.processTargets(Gant.groovy:495) at gant.Gant.processTargets(Gant.groovy:480)

A sample project is attached. Just run grails test-app and the error appears.

graemerocher commented 14 years ago

bort1002000 said: Seems to be related to GRAILS-5348

graemerocher commented 13 years ago

graemerocher said: the new unit testing framework mocks calls to message