Skip to content

Commit 1b044c2

Browse files
committed
Moved default value to ReporterConfig instead of Command line interpretation
1 parent ebda736 commit 1b044c2

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
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", defaultValue = "ut_documentation_reporter")
102+
@Option(names = {"-f", "--format"}, required = true, description = "Enables specified format reporting")
103103
String format;
104104
@Option(names = {"-o"}, description = "Outputs format to file")
105105
String outputFile;

src/main/java/org/utplsql/cli/config/ReporterConfig.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.utplsql.cli.config;
22

3+
import org.utplsql.api.reporter.CoreReporters;
4+
35
import java.beans.ConstructorProperties;
46

57
public class ReporterConfig {
@@ -10,7 +12,11 @@ public class ReporterConfig {
1012

1113
@ConstructorProperties({"name", "output", "forceToScreen"})
1214
public ReporterConfig(String name, String output, Boolean forceToScreen) {
13-
this.name = name;
15+
if ( name != null ) {
16+
this.name = name;
17+
} else {
18+
this.name = CoreReporters.UT_DOCUMENTATION_REPORTER.name();
19+
}
1420
this.output = output;
1521
if (forceToScreen != null) this.forceToScreen = forceToScreen;
1622
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ void outputWithDefaultReporter() throws Exception {
172172
assertNotNull( config.getReporters() );
173173

174174
ReporterConfig reporterConfig = config.getReporters()[0];
175-
assertEquals("ut_documentation_reporter", reporterConfig.getName());
175+
assertEquals("ut_documentation_reporter", reporterConfig.getName().toLowerCase());
176176
assertEquals("output1.txt", reporterConfig.getOutput());
177177
assertFalse(reporterConfig.isForceToScreen());
178178
}

0 commit comments

Comments
 (0)