public class GroovyAssert
extends java.lang.Object
Constructor and Description |
---|
GroovyAssert() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Throwable |
shouldFail(java.lang.Class clazz,
Closure code)
Asserts that the given code closure fails when it is evaluated
and that a particular type of exception is thrown.
|
static java.lang.Throwable |
shouldFail(Closure code)
Asserts that the given code closure fails when it is evaluated
|
static java.lang.Throwable |
shouldFailWithCause(java.lang.Class expectedCause,
Closure code)
Asserts that the given code closure fails when it is evaluated
and that a particular Exception type can be attributed to the cause.
|
public static java.lang.Throwable shouldFail(Closure code)
code
- the code expected to failpublic static java.lang.Throwable shouldFail(java.lang.Class clazz, Closure code)
clazz
- the class of the expected exceptioncode
- the closure that should failpublic static java.lang.Throwable shouldFailWithCause(java.lang.Class expectedCause, Closure code)
If a match is found, the matching exception is returned otherwise the method will fail.
expectedCause
- the class of the expected exceptioncode
- the closure that should fail