Skip to content

Commit a900d64

Browse files
author
Robin Duda
committed
fixed a test case that did not fail under the right conditions.
1 parent 65f1e64 commit a900d64

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

core/test/java/com/codingchili/core/context/LauncherCommandExecutorTest.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.codingchili.core.context;
22

33
import com.codingchili.core.configuration.system.LauncherSettings;
4+
import com.codingchili.core.context.exception.NoSuchCommandException;
45
import com.codingchili.core.files.Configurations;
56
import com.codingchili.core.testing.MockLogListener;
67
import io.vertx.core.Future;
@@ -61,16 +62,25 @@ private Command getHiddenCommand() {
6162

6263
@Test
6364
public void testGetHelpMessage(TestContext test) {
64-
try {
65-
execute(MISSING_COMMAND);
66-
} catch (CoreRuntimeException e) {
65+
Async async = test.async();
66+
Future<CommandResult> future = Future.future();
67+
68+
future.setHandler(done -> {
69+
test.assertFalse(done.succeeded());
70+
Throwable e = done.cause();
6771
test.assertTrue(e.getMessage().contains(HELP));
6872
test.assertTrue(e.getMessage().contains(MISSING_COMMAND));
69-
}
73+
async.complete();
74+
});
75+
76+
new LauncherCommandExecutor(
77+
new LaunchContextMock((line) -> {}).logger())
78+
.execute(future, MISSING_COMMAND);
7079
}
7180

7281
@Test
7382
public void testConfiguredBlocksListed(TestContext test) {
83+
System.err.println(getOutput(HELP));
7484
test.assertTrue(getOutput(HELP).contains(BLOCK_1));
7585
test.assertTrue(getOutput(HELP).contains(BLOCK_2));
7686
}
@@ -97,7 +107,7 @@ private String getOutput(String arg) {
97107

98108

99109
execute(arg, logged -> {
100-
message[0] += logged;
110+
message[0] += logged + "\n";
101111
});
102112

103113
return message[0];

0 commit comments

Comments
 (0)