Skip to content

Commit ebda736

Browse files
committed
Make ut_documentation_reporter the default for commandline
Fixes #170
1 parent dddafb0 commit ebda736

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

src/main/java/org/utplsql/cli/RunPicocliCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public class RunPicocliCommand implements IRunCommand {
9999
private List<Format> reporters = new ArrayList<>();
100100

101101
static class Format {
102-
@Option(names = {"-f", "--format"}, required = true, description = "Enables specified format reporting")
102+
@Option(names = {"-f", "--format"}, required = true, description = "Enables specified format reporting", defaultValue = "ut_documentation_reporter")
103103
String format;
104104
@Option(names = {"-o"}, description = "Outputs format to file")
105105
String outputFile;

src/test/java/org/utplsql/cli/PicocliRunCommandTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,20 @@ void multipleReporters() throws Exception {
163163
assertTrue(reporterConfig.isForceToScreen());
164164
}
165165

166+
@Test
167+
void outputWithDefaultReporter() throws Exception {
168+
RunCommandConfig config = parseForConfig("run",
169+
TestHelper.getConnectionString(),
170+
"-o=output1.txt");
171+
172+
assertNotNull( config.getReporters() );
173+
174+
ReporterConfig reporterConfig = config.getReporters()[0];
175+
assertEquals("ut_documentation_reporter", reporterConfig.getName());
176+
assertEquals("output1.txt", reporterConfig.getOutput());
177+
assertFalse(reporterConfig.isForceToScreen());
178+
}
179+
166180
@Test
167181
void sourceFileMapping() throws Exception {
168182
RunCommandConfig config = parseForConfig("run",

src/test/java/org/utplsql/cli/RunCommandIT.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,18 @@ void run_withDbmsOutputEnabled() throws Exception {
7575

7676
assertValidReturnCode(result);
7777
}
78+
79+
@Test
80+
void run_withOutputButNoReporterDefined() throws Exception {
81+
82+
String outputFileName = "output_" + System.currentTimeMillis() + ".xml";
83+
addTempPath(Paths.get(outputFileName));
84+
85+
int result = TestHelper.runApp("run",
86+
TestHelper.getConnectionString(),
87+
"-o=" + outputFileName,
88+
"--failure-exit-code=2");
89+
90+
assertValidReturnCode(result);
91+
}
7892
}

0 commit comments

Comments
 (0)