| Grails Testing Plugin often occurred exception |
|
In previous posts (service unit testing and domain entity unit testing) I told You a lot about Grails Testing Plugin, its simple usage, but have not paid necessary accent on one often occurred exception: "Cannot invoke method containsKey() on null object" type="java.lang.NullPointerException"
It happens then You override setUp() method but forget to call super method at first. So instead of writing:
class SomeTests extends GrailsUnitTestCase {
void setUp() { // Some initializations. }
}
Call super method at first:
class SomeTests extends GrailsUnitTestCase {
void setUp() {
// Call super method at first. super.setUp()
// Some initializations. }
}
That's all. |
Comments
RSS feed for comments to this post.