In the 1.3-RC1 release docs, this breaking change is announced:
def extern = null
1 * mock.foo( { extern = it; it.size() > 0 }) // old
1 * mock.foo( { it.size() > 0 }) >> { extern = it[0] } // new
What if I have ...
def extern = null
def bar = new Bar()
1 * mock.foo({ extern = it }) >> bar
... how does that translate to the new format?
/cc: @leonard84
Just return bar from the closure
def extern = null
def bar = new Bar()
1 * mock.foo(_) >> { extern = it[0] ; bar }
Most helpful comment
Just return
barfrom the closure