-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Description
The method Runtime.isVoidMethod does not handle the case of target being null and fails with a NPE.
Since most of Geb's own methods return empty strings, empty lists, or empty Navigators this problem does not occur often.
If you take this page, the at check won't fail because helper does not contain "test" or is null. It will cause an NPE.
class PageWithNullInAtChecker extends Page {
static at = { helper()?.contains("test") }
String helper() {
return null
}
}
java.lang.NullPointerException
at geb.transform.implicitassertions.Runtime.isVoidMethod(Runtime.java:18)
at geb.PageWithNullInAtChecker._clinit__closure1(PageOrientedSpec.groovy:533)
at geb.PageWithNullInAtChecker._clinit__closure1(PageOrientedSpec.groovy)
at geb.Page.verifyThisPageAtOnly(Page.groovy:228)
at geb.Page.verifyAt(Page.groovy:182)
at geb.Browser.doAt(Browser.groovy:455)
at geb.Browser.at(Browser.groovy:354)
at geb.Browser.to(Browser.groovy:566)
at geb.Browser.to(Browser.groovy:553)
at geb.Browser.to(Browser.groovy:520)
at geb.test.GebSpec.methodMissing(GebSpec.groovy:91)
at geb.PageOrientedSpec.implicit assertions should handle null(PageOrientedSpec.groovy:401)