Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.