Phoenix
Phoenix

Reputation: 8933

expect clause in GroovyTestCase

@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

Answers (2)

Arturo Herrero
Arturo Herrero

Reputation: 13140

In GroovyTestCase you can use shouldFail. Try this:

void testNullArgument()
{
    shouldFail(IllegalArgumentException)
    {
        archiveUtility.process(lstFileName, "", workflowId)
    }

}

Upvotes: 3

bluesman
bluesman

Reputation: 2260

Have you tried adding a .class (expected=IllegalArgumentException.class) ?

Upvotes: 0

Related Questions