Skip to content

Instantly share code, notes, and snippets.

@moznion
Created November 23, 2012 06:36
Show Gist options
  • Save moznion/4134250 to your computer and use it in GitHub Desktop.
Save moznion/4134250 to your computer and use it in GitHub Desktop.
Usage of shouldFail(java.lang.Class clazz, Closure code)
import groovy.util.GroovyTestCase
public class Test extends GroovyTestCase {
public void test() {
shouldFail (NullPointerException) {throw new NullPointerException()}
shouldFail (IllegalAccessError) {throw new IllegalAccessError()}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment