Test MessageProducer end/close methods with no/null handler

This commit is contained in:
Julien Viet
2019-06-28 09:09:14 +02:00
parent af7513ee74
commit c78b8a14fb
2 changed files with 25 additions and 1 deletions

View File

@@ -147,7 +147,11 @@ public class MessageProducerImpl<T> implements MessageProducer<T> {
if (creditConsumer != null) {
creditConsumer.unregister(handler);
} else {
vertx.runOnContext(v -> handler.handle(Future.succeededFuture()));
vertx.runOnContext(v -> {
if (handler != null) {
handler.handle(Future.succeededFuture());
}
});
}
}

View File

@@ -1272,6 +1272,26 @@ public class LocalEventBusTest extends EventBusTestBase {
await();
}
@Test
public void testCloseSender1() {
eb.sender(ADDRESS1).close();
}
@Test
public void testCloseSender2() {
eb.sender(ADDRESS1).close(null);
}
@Test
public void testClosePublisher1() {
eb.publisher(ADDRESS1).close();
}
@Test
public void testClosePublisher2() {
eb.publisher(ADDRESS1).close(null);
}
@Test
public void testPump() {
String str = TestUtils.randomUnicodeString(100);