Skip to content

Commit 497858c

Browse files
committed
update
1 parent d6610b2 commit 497858c

File tree

4 files changed

+30
-8
lines changed

4 files changed

+30
-8
lines changed

parquet-cli/src/test/java/org/apache/parquet/cli/ShowSizeStatisticsCliTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ public void showSizeStatistics() throws Exception {
3535

3636
@Test
3737
public void showsHelpMessage() throws Exception {
38-
cli("help size-stats")
39-
.ok()
40-
.matchOutputFromFile("src/test/resources/cli-outputs/size-stats-help.txt");
38+
cli("help size-stats").ok().matchOutputFromFile("src/test/resources/cli-outputs/size-stats-help.txt");
4139
}
4240

4341
@Test

parquet-cli/src/test/java/org/apache/parquet/cli/testing/CapturingLogger.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ String dump() {
4545
return buf.toString();
4646
}
4747

48-
4948
// Since the CLI logic can call any console method, this is some needed delegator code to
5049
// ensure all methods are coverted and that the test harness does not miss anything.
5150
// Unfortunately slf4j API does not make this easy to do in a generic way, so we

parquet-cli/src/test/java/org/apache/parquet/cli/testing/CliResult.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
package org.apache.parquet.cli.testing;
2020

2121
import static org.junit.Assert.*;
22+
23+
import java.nio.charset.StandardCharsets;
2224
import java.nio.file.Files;
2325
import java.nio.file.Paths;
24-
import java.nio.charset.StandardCharsets;
2526

2627
public final class CliResult {
2728
public final int exitCode;
@@ -64,9 +65,7 @@ public CliResult lineCount(int expected) {
6465
}
6566

6667
public CliResult matchOutputFromFile(String filePath) throws Exception {
67-
String expected = new String(
68-
Files.readAllBytes(Paths.get(filePath)),
69-
StandardCharsets.UTF_8);
68+
String expected = new String(Files.readAllBytes(Paths.get(filePath)), StandardCharsets.UTF_8);
7069
return outputContains(expected);
7170
}
7271
}

parquet-cli/src/test/java/org/apache/parquet/cli/testing/CliTestBase.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,32 @@
2020

2121
import org.apache.parquet.cli.commands.ParquetFileTest;
2222

23+
/**
24+
* Base class for CLI integration tests with an API for testing command output.
25+
*
26+
* Developer Usage Examples:
27+
*
28+
* // Basic command execution and assertion
29+
* cli("schema file.parquet")
30+
* .ok()
31+
* .outputContains("int32_field", "int64_field");
32+
*
33+
* // Test help output
34+
* cli("help size-stats")
35+
* .ok()
36+
* .matchOutputFromFile("expected-help.txt");
37+
*
38+
* // Test error conditions
39+
* cli("invalid-command")
40+
* .fails(1)
41+
* .outputContains("Unknown command");
42+
*
43+
* // Test command with multiple arguments
44+
* cli("size-stats parquetFile.getAbsolutePath()")
45+
* .ok()
46+
* .lineCount(8);
47+
*
48+
*/
2349
public abstract class CliTestBase extends ParquetFileTest {
2450
private final CliHarness harness = new CliHarness();
2551

0 commit comments

Comments
 (0)