| java.lang.NullPointerException: Cannot get property 'principal' on null object
Somebody else had a similar problem and their solution is to to an outright mock:
http://stackoverflow.com/questions/10275803/how-to-mock-a-service-injected-in-a-domain-class-from-a-controller-test-class
However, the springSecurityService seems to be populated when I call the mockCommandObject().validate()
Tuesday, 20 November 2012
Grails unit test: | java.lang.NullPointerException: Cannot get property 'principal' on null object
So I have a controller that uses a command object as the param and the controller also uses the springSecurityService and am writing a test to cover the flow.
For the life of me, if I don't call .validate() on the mocked command object, I get an error stating that the injected springSecurityService is null:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment