blob: c365469d28b5c6823cc030f5b1cd70aec7fdce15 [file] [log] [blame]
package groovy
/**
* Tests exception handling inside of a closure
*
* @author <a href="mailto:james@coredevelopers.net">James Strachan</a>
* @version $Revision$
*/
class ExceptionInClosureTest extends GroovyTestCase {
void testCallingOfFailedClosure() {
def closure = { it -> it.foo() }
try {
closure.call("cheese")
fail("Should have thrown an exception by now")
}
catch (MissingMethodException e) {
System.out.println("Caught: " + e)
assert e.method == "foo"
assert e.type == String
}
}
}