Reputation: 8933
@Test(expected=IllegalArgumentException)
void testNullArgument()
{
archiveUtility.process(lstFileName, "", workflowId)
}
When I call process method on archiveUtility object it throws an IllegalArgumentException but my test still fails even though I have declared the test to expect IllegalArgumentException. This is a groovyTestCase. Am unable to figure out why so ? Any thoughts ?
Upvotes: 1
Views: 521
Reputation: 13140
In GroovyTestCase you can use shouldFail. Try this:
void testNullArgument()
{
shouldFail(IllegalArgumentException)
{
archiveUtility.process(lstFileName, "", workflowId)
}
}
Upvotes: 3
Reputation: 2260
Have you tried adding a .class (expected=IllegalArgumentException.class) ?
Upvotes: 0