Details
Description
In http://blog.springsource.com/2011/06/07/countdown-to-grails-1-4-unit-testing/, Peter states that "The standard Grails tags will just work and you can enable other tags by simply calling mockTagLib() with the relevant TagLib class."
However, tests still fail with the following errors:
groovy.lang.MissingMethodException: No signature of method: myproj.MyprojTagLib.message() is applicable for argument types: (java.util.LinkedHashMap) values: [[code:taglib.thetag.title, default:Default Message, ...]]
Possible solutions: isCase(java.lang.Object)
at myproj.MyprojTagLib$_closure14.doCall(MyprojTagLib.groovy:379)
at myproj.MyprojTagLibTests.testOutputIsFreeOfAnyInlineScripts(MyprojTagLibTests.groovy:56)
// Line 379 of MyprojTagLib.groovy: def title = (attrs?.remove('title') ?: message(code:"taglib.thetag.title", default:"Default Message", locale: dataLocale)).encodeAsHTML()
// Line 56 of MyprojTagLibTests.groovy: assert !(tagLib.theTag(name:'p'){"Arbitrary Body"}.toString()).contains("script")
Is this a bug, or is the according feature simply yet to be implemented?
-
Hide
- helloworld-bug-report-11102011.zip
- 11/Oct/11 9:10 AM
- 22 kB
- Graeme Rocher
-
- grails-app/conf/BootStrap.groovy 0.1 kB
- grails-app/conf/BuildConfig.groovy 2 kB
- grails-app/conf/Config.groovy 4 kB
- grails-app/conf/DataSource.groovy 1 kB
- grails-app/conf/UrlMappings.groovy 0.2 kB
- grails-app/conf/spring/resources.groovy 0.0 kB
- grails-app/.../HelloController.groovy 0.1 kB
- grails-app/domain/.../Person.groovy 0.1 kB
- grails-app/i18n/messages.properties 3 kB
- grails-app/.../messages_cs_CZ.properties 3 kB
- grails-app/i18n/messages_da.properties 3 kB
- grails-app/i18n/messages_de.properties 4 kB
- grails-app/i18n/messages_es.properties 3 kB
- grails-app/i18n/messages_fr.properties 2 kB
- grails-app/i18n/messages_it.properties 2 kB
- grails-app/i18n/messages_ja.properties 4 kB
- grails-app/i18n/messages_nl.properties 3 kB
- grails-app/.../messages_pt_BR.properties 3 kB
- grails-app/.../messages_pt_PT.properties 3 kB
- grails-app/i18n/messages_ru.properties 4 kB
- grails-app/i18n/messages_sv.properties 3 kB
- grails-app/i18n/messages_th.properties 5 kB
- grails-app/.../messages_zh_CN.properties 2 kB
- grails-app/taglib/.../MyprojTagLib.groovy 0.3 kB
- grails-app/views/error.gsp 0.3 kB
- grails-app/views/index.gsp 3 kB
- grails-app/views/layouts/main.gsp 2 kB
- test/unit/.../HelloControllerTests.groovy 0.3 kB
- test/unit/.../MyprojTagLibTests.groovy 0.4 kB
- test/unit/helloworld/PersonTests.groovy 0.2 kB
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
Example application that demonstrates the functionality in question is working
I've attached an example that works fine against current git master. If you continue to have issues please attach an example that reproduces the problem.
If I amend the example as follows, an NPE is caused (see below).
java.lang.NullPointerException
at grails.test.mixin.web.GroovyPageUnitTestMixin.applyTemplate(GroovyPageUnitTestMixin.groovy:129)
at grails.test.mixin.web.GroovyPageUnitTestMixin.applyTemplate(GroovyPageUnitTestMixin.groovy:122)
at myproj.MyprojTagLibTests.testOutputIsFreeOfAnyInlineScripts(MyprojTagLibTests.groovy:60)