Skip to content

Commit

Permalink
use async test facilities properly (I hope)
Browse files Browse the repository at this point in the history
Signed-off-by: Oded Arbel <oded@geek.co.il>
  • Loading branch information
guss77 authored and vietj committed Feb 10, 2017
1 parent 017ed28 commit 1c3603e
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/test/java/io/vertx/test/core/VertxTest.java
Expand Up @@ -14,6 +14,7 @@

import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

/**
Expand Down Expand Up @@ -97,16 +98,18 @@ public void close(Handler<AsyncResult<Void>> completionHandler) {

@Test
public void testClusterManagerFailure() throws Exception {
VertxOptions options = new VertxOptions().setClusterManager(new FakeClusterManager(){
@Override
public void join(Handler<AsyncResult<Void>> resultHandler) {
resultHandler.handle(Future.failedFuture(new Exception()));
}

});
Future<Vertx> f = Future.future();
Vertx.clusteredVertx(options, f.completer());
assertFalse(f.succeeded());
VertxOptions options = new VertxOptions().setClusterManager(new FakeClusterManager(){
@Override
public void join(Handler<AsyncResult<Void>> resultHandler) {
resultHandler.handle(Future.failedFuture(new Exception("joinfailure")));
}
});
Vertx.clusteredVertx(options, ar -> {
assertTrue(ar.failed());
assertEquals("joinfailure", ar.cause().getMessage());
testComplete();
});
await();
}

}

0 comments on commit 1c3603e

Please sign in to comment.