Q:

Spock framework only one exception condition is allowed per 'then' block

org.spockframework:spock-core:1.0-groovy-2.4
Gradle 2.4
Groovy 2.3.10

I am using gradle and spock framework to test my java code. However, the function I am testing can throw 3 different exceptions that I need to test for. However, in my then clause I list the 3 exceptions and if any of them are not thrown the test will pass. However, I keep getting the following compile error:
318: Only one exception condition is allowed per 'then' block @ line 318, column 9.
           notThrown NoResponseException

319: Only one exception condition is allowed per 'then' block @ line 319, column 9.
           notThrown NotConnectedException

My spock function I am using for testing. The function being tested can throw those exceptions.
   def 'Create instant pubsub node'() {
       setup:
        smackClient.initializeConnection(domain, serviceName, resource, port, timeout, debugMode)
        smackClient.connectAndLogin(username, password)

        when:
        smackClient.getSPubSubInstance(smackClient.getClientConnection()).createInstantnode()

        then:
        notThrown XMPPErrorException
        notThrown NoResponseException
        notThrown NotConnectedException
    }

Is there a way to test for more than 3 exceptions in a single then clause?
I have also tried this which didn't work either by separating into 3 individual then clauses.
then:
notThrown XMPPErrorException

then:
notThrown NoResponseException

then:
notThrown NotConnectedException

A:

the best I've come up with is use a where: clause
def 'Create instant pubsub node'() {
   setup:
    smackClient.initializeConnection(domain, serviceName, resource, port, timeout, debugMode)
    smackClient.connectAndLogin(username, password)

    when:
    smackClient.getSPubSubInstance(smackClient.getClientConnection()).createInstantnode()

    then:
    notThrown exception

    where:
    exception << [XMPPErrorException, NoResponseException, NotConnectedException]
}

I've created a simpler example on the spock web console

