Skip to content

Commit 2627cbf

Browse files
dfa1claude
andcommitted
test(cli): cover VortexCli.printUsage
main() dispatches then calls System.exit (covered end-to-end by CliIT); pin the pure printUsage helper so the usage text keeps advertising every subcommand the dispatch switch handles. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7805824 commit 2627cbf

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package io.github.dfa1.vortex.cli;
2+
3+
import org.junit.jupiter.api.Test;
4+
5+
import java.io.ByteArrayOutputStream;
6+
import java.io.PrintStream;
7+
import java.nio.charset.StandardCharsets;
8+
9+
import static org.assertj.core.api.Assertions.assertThat;
10+
11+
/// `main` dispatches and calls `System.exit`, so it is covered end-to-end by the CLI
12+
/// integration test rather than here. This pins the one pure, unit-testable piece — the
13+
/// usage text must advertise every subcommand `main` actually dispatches.
14+
class VortexCliTest {
15+
16+
@Test
17+
void printUsage_listsEverySubcommand() {
18+
// Given
19+
ByteArrayOutputStream buf = new ByteArrayOutputStream();
20+
21+
// When
22+
VortexCli.printUsage(new PrintStream(buf, true, StandardCharsets.UTF_8));
23+
24+
// Then — one line per subcommand handled by main()'s switch
25+
String usage = buf.toString(StandardCharsets.UTF_8);
26+
assertThat(usage)
27+
.contains("Usage:")
28+
.contains("inspect")
29+
.contains("tui")
30+
.contains("view")
31+
.contains("export")
32+
.contains("import")
33+
.contains("schema")
34+
.contains("count")
35+
.contains("select")
36+
.contains("stats")
37+
.contains("filter");
38+
}
39+
}

0 commit comments

Comments
 (0)