Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0-JSR-5
-
Fix Version/s: 1.0-JSR-6
-
Component/s: None
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
Description
GroovyTestCase.shouldFail{} should return the message of the enclosed Exception.
This would allow easier testing that the Exception reveals a meaningful message.
def result = shouldFail(IllegalArgumentException.class){
throw new IllegalArgumentException('null not allowed')
}
assertEquals 'null not allowed', result
Thanks Dierk for this useful feature. Here is another example:
assert (shouldFail
{ this.methodThatDoesNotExist(404) }).contains("MissingMethodException")