@BeforeClass public static void init(TestContext context) throws IOException {
/*
...
Code for starting embedded mongo based on http://vertx.io/blog/combine-vert-x-and-mongo-to-build-a-giant/
...
*/ MONGO = mongodExecutable.start();
List<Item> items = getData();
Async async = context.async(items.size());
JsonObject config = new JsonObject().put("host", "localhost").put("port", MONGO_PORT); MongoClient mongoClient = MongoClient.createShared(vertx, config);
for (Item item : items) { mongoClient.insert( COLLECTION, new JsonObject(Json.encode(item)), res -> async.countDown()); } async.await(); mongoClient.close(); }