Skip to content

Instantly share code, notes, and snippets.

@pmlopes
Created June 23, 2015 09:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pmlopes/459d4205acf89173dca4 to your computer and use it in GitHub Desktop.
Save pmlopes/459d4205acf89173dca4 to your computer and use it in GitHub Desktop.
Spock and Vertx3
import io.vertx.core.Vertx
import spock.lang.Shared
import spock.lang.Specification
import spock.util.concurrent.BlockingVariable
class HelloSpockSpec extends Specification {
@Shared
def Vertx vertx = Vertx.vertx()
def "test async vert.x"() {
setup:
def result = new BlockingVariable()
when:
vertx.setTimer(1l) { timerId ->
result.set('OK')
}
println "wait 1s"
then:
result.get() == 'OK'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment