New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE in implicitassertions.Runtime.isVoidMethod #398

Closed
leonard84 opened this Issue Aug 11, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@leonard84

leonard84 commented Aug 11, 2015

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)

@erdi erdi added the Bug label Aug 13, 2015

@erdi erdi added this to the 0.12.2 milestone Aug 13, 2015

@erdi erdi self-assigned this Aug 13, 2015

@erdi

This comment has been minimized.

Member

erdi commented Aug 13, 2015

Thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment