Skip to content

Commit f7a620a

Browse files
committed
Improve tests
1 parent 6b7692a commit f7a620a

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
<properties>
3232
<stack.version>3.6.0-SNAPSHOT</stack.version>
33-
<termd.version>1.1.3</termd.version>
33+
<termd.version>1.1.5</termd.version>
3434
</properties>
3535

3636
<dependencyManagement>

src/main/java/io/vertx/ext/shell/command/base/BusTail.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void setLocal(boolean local) {
8383
public void process(CommandProcess process) {
8484
EventBus eb = process.vertx().eventBus();
8585
List<MessageConsumer<Object>> consumers = addresses.stream().map(address -> {
86-
Handler<Message<Object>> consumer = msg -> {
86+
Handler<Message<Object>> handler = msg -> {
8787
Object body = msg.body();
8888
String bodyString;
8989
if (body instanceof Buffer) {
@@ -103,7 +103,7 @@ public void process(CommandProcess process) {
103103
process.write(address + ":" + bodyString + "\n");
104104
}
105105
};
106-
return local ? eb.localConsumer(address, consumer) : eb.consumer(address, consumer);
106+
return local ? eb.localConsumer(address, handler) : eb.consumer(address, handler);
107107
}).collect(Collectors.toList());
108108
process.interruptHandler(done -> {
109109
process.end();

src/test/java/io/vertx/ext/shell/command/base/BusTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,14 @@ private void assertSend(TestContext context, String address, Object body, int ti
352352
}
353353

354354
private void assertSend(TestContext context, String address, Object body, DeliveryOptions options, int times) {
355-
context.assertTrue(times > 0);
355+
context.assertTrue(times > 0, "Could not send message " + body + " to address " + address);
356356
vertx.eventBus().send(address, body, options, ar -> {
357357
if (ar.failed()) {
358358
ReplyException ex = (ReplyException) ar.cause();
359359
if (ex.failureType() == NO_HANDLERS) {
360360
assertSend(context, address, body, options, times - 1);
361+
} else {
362+
context.fail();
361363
}
362364
}
363365
});

src/test/java/io/vertx/ext/shell/term/TelnetTermServerTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import java.io.Writer;
5858
import java.net.URL;
5959
import java.nio.charset.StandardCharsets;
60+
import java.util.concurrent.CompletableFuture;
6061
import java.util.function.Consumer;
6162

6263
/**
@@ -249,14 +250,19 @@ public void testOutBinaryFalse(TestContext context) throws Exception {
249250

250251
@Test
251252
public void testDifferentCharset(TestContext context) throws Exception {
253+
CompletableFuture<Void> closeLatch = new CompletableFuture<Void>();
252254
startTelnet(context, new TelnetTermOptions().setCharset("ISO_8859_1"), term -> {
253255
term.write("\u20AC");
254-
term.close();
256+
closeLatch.thenAccept(v -> {
257+
term.close();
258+
});
255259
});
256260
client.connect("localhost", server.actualPort());
257261
InputStream in = client.getInputStream();
258262
int b = in.read();
259263
context.assertEquals(63, b);
264+
closeLatch.complete(null);
265+
260266
}
261267

262268
@Test

0 commit comments

Comments
 (0)