Skip to content

Instantly share code, notes, and snippets.

@dkowis
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save dkowis/3b5af9fa6bafdd7aa962 to your computer and use it in GitHub Desktop.

Select an option

Save dkowis/3b5af9fa6bafdd7aa962 to your computer and use it in GitHub Desktop.
import org.spockframework.runtime.SpockAssertionError
import spock.lang.Specification
import spock.util.concurrent.PollingConditions
class TimeoutExceptionProof extends Specification {
final def pollingConditions = new PollingConditions(timeout: 10, initialDelay: 1)
def "why does it fail"() {
when:
def foo = "bar"
then:
def loopCount = 0
try {
pollingConditions.eventually {
loopCount += 1
Thread.sleep(2500)
assert false == true
}
} catch (IllegalArgumentException iae) {
throw new SpockAssertionError("Illegal Arg exception: loop count $loopCount", iae)
}
}
}
@dkowis

dkowis commented Jan 20, 2015

Copy link
Copy Markdown
Author

Noting that the longer that delay within the eventually is, the sooner in the loop count it's going to tank.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment