Catch assertion exceptions in Groovy

If you would like to handle the exception raised from an assert you can use the following snippet.

try {
	assert 1 == 2 : "one != two"
} catch(AssertionError e) {
	println e.getMessage()
}

It will print out only the message of the exception and not the stack strace

one != two. Expression: (1 == 2)