Create a gist now

Instantly share code, notes, and snippets.

anonymous /overloading.groovy
Created Feb 24, 2017

What would you like to do?
def "myMethod without arguments has side effect 1" {
when:
myMethod()
then:
// assert side effect 1
}
def "myMethod without arguments has side effect 2" {
when:
myMethod()
then:
// assert side effect 2
}
def "myMethod without arguments throws an exception when something" {
given:
// some bad state
when:
myMethod()
then:
thrown SomeException
}
def "myMethod with arguments has side effect 1" {
when:
myMethod("some string")
then:
// assert side effect 1
}
def "myMethod with arguments has side effect 2" {
when:
myMethod("some string")
then:
// assert side effect 2
}
def "myMethod with arguments throws an exception when something" {
given:
// some bad state
when:
myMethod("some string")
then:
thrown SomeException
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment