Created
December 31, 2015 09:38
-
-
Save aesteve/cabe8123023fa66b119e to your computer and use it in GitHub Desktop.
async bdd unit runner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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