Skip to content

Instantly share code, notes, and snippets.

@finnjohnsen
Last active December 16, 2015 07:38
Show Gist options
  • Save finnjohnsen/5399709 to your computer and use it in GitHub Desktop.
Save finnjohnsen/5399709 to your computer and use it in GitHub Desktop.
void "starting jobs creates threads"() {
when:
myService.startJobs()
Thread.sleep(300)
then:
Thread.getAllStackTraces().keySet().findAll \\
{Thread thread -> thread.name.contains "Job"}.size() > 1
cleanup:
myService.endJobs() //important, or you risk threads contaminating your next test. (happened to me)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment