Skip to content

Instantly share code, notes, and snippets.

@aesteve
Created December 31, 2015 09:38
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 aesteve/cabe8123023fa66b119e to your computer and use it in GitHub Desktop.
Save aesteve/cabe8123023fa66b119e to your computer and use it in GitHub Desktop.
async bdd unit runner
class MyAsyncSpec {
@Test
void asyncTestRequest(TestContext context) {
// startsWith async => creates context.async()
def client
setup {
client = vertx.createHttpClient(...)
}
when {
client.getNow('/api')
}
then { response -> // automatically registers the then(Closure closure) as a handler of the object returned by when {}
context.assertEquals(response.statusCode(), 200)
// evaluate all the conditions, if nothing is thrown then async.complete()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment