grails mockFor closure wierdness

Posted by hvgotcodes on Stack Overflow See other posts from Stack Overflow or by hvgotcodes
Published on 2010-05-27T16:30:27Z Indexed on 2010/05/27 16:31 UTC
Read the original article Hit count: 176

Filed under:
|

Right,

so when I set up my mock using the testing plugin's mockFor method, I expect a method that returns null. If I do

myControl.demand.theMethod {return null}

in the debugger, the value that I set the 'theMethod' call result to is some closure in the debugger.

If I do

myControl.demand.theMethod {->return null}

the value is null, as expected.

I dont understand the difference....

© Stack Overflow or respective owner

Related posts about grails

Related posts about groovy