I get the following error…
Cannot get property 'grails' on null object
java.lang.NullPointerException: Cannot get property 'grails' on null object
at pcc.EmailSharerController.<init>(EmailSharerController.groovy)
at grails.test.MvcUnitTestCase.newInstance(MvcUnitTestCase.groovy:102)
at grails.test.ControllerUnitTestCase.super$6$newInstance(ControllerUnitTestCase.groovy)
at grails.test.ControllerUnitTestCase.newInstance(ControllerUnitTestCase.groovy:112)
at grails.test.ControllerUnitTestCase.setUp(ControllerUnitTestCase.groovy:55)
at pcc.EmailSharerControllerTests.super$7$setUp(EmailSharerControllerTests.groovy)
at pcc.EmailSharerControllerTests.setUp(EmailSharerControllerTests.groovy:12)
…when I run the unit test setUp() of my EmailSharerController, even when it is reduced to this:
protected void setUp() {
super.setUp()
}
I have browsed the web and found nothing.
I do not any guess from where it could come.
Any help greatly apreciated 🙂
Problem was that Grails does not support the ConfigurationHolder object in unit tests.
It is possible to solve it this way:
to call the
grails.serverURLproperty of Config.groovy for example.