Skip to content

Instantly share code, notes, and snippets.

@dkowis
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkowis/3b5af9fa6bafdd7aa962 to your computer and use it in GitHub Desktop.
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
Copy link
Author

dkowis commented Jan 20, 2015

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