1
2
3
4
5
6 package dev.metaschema.cli.commands.metapath;
7
8 import static org.assertj.core.api.Assertions.assertThat;
9
10 import org.junit.jupiter.api.Test;
11 import org.junit.jupiter.api.parallel.Execution;
12 import org.junit.jupiter.api.parallel.ExecutionMode;
13
14 import java.io.OutputStream;
15 import java.io.PrintStream;
16
17 import dev.metaschema.cli.CLI;
18 import nl.altindag.log.LogCaptor;
19
20 @Execution(value = ExecutionMode.SAME_THREAD, reason = "Log capturing needs to be single threaded")
21 class EvaluateMetapathSubCommandTest {
22
23
24
25
26
27 @SuppressWarnings("resource")
28 private static final PrintStream NULL_STREAM = new PrintStream(new OutputStream() {
29 @Override
30 public void write(int b) {
31
32 }
33 });
34
35 @Test
36 void test() {
37 try (LogCaptor captor = LogCaptor.forRoot()) {
38 String[] args
39 = {
40 "metapath",
41 "eval",
42 "-e",
43 "3 + 4 + 5",
44 "--show-stack-trace" };
45 CLI.runCli(NULL_STREAM, args);
46 assertThat(captor.getInfoLogs().contains("12"));
47 }
48 }
49 }