Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Prev Previous commit
Next Next commit
Adjusted default run-Test and refactoring
  • Loading branch information
pesse authored and Samuel Nitsche committed Nov 11, 2017
commit 286cdba93d0f4e413dc3a6b300705b9c20ddd3f1
21 changes: 14 additions & 7 deletions src/test/java/org/utplsql/cli/RunCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@ private RunCommand createRunCommand(String... args) {
return runCmd;
}

private String getConnectionString() {
return sUser + "/" + sPass + "@" + sUrl;
}

@Test
public void reporterOptions_Default() {
RunCommand runCmd = createRunCommand("app/app@xe");
RunCommand runCmd = createRunCommand(getConnectionString());

List<ReporterOptions> reporterOptionsList = runCmd.getReporterOptionsList();

Expand All @@ -48,7 +52,7 @@ public void reporterOptions_Default() {

@Test
public void reporterOptions_OneReporter() {
RunCommand runCmd = createRunCommand("app/app@xe", "-f=ut_documentation_reporter", "-o=output.txt");
RunCommand runCmd = createRunCommand(getConnectionString(), "-f=ut_documentation_reporter", "-o=output.txt");

List<ReporterOptions> reporterOptionsList = runCmd.getReporterOptionsList();

Expand All @@ -61,7 +65,7 @@ public void reporterOptions_OneReporter() {

@Test
public void reporterOptions_OneReporterForceScreen() {
RunCommand runCmd = createRunCommand("app/app@xe", "-f=ut_documentation_reporter", "-o=output.txt", "-s");
RunCommand runCmd = createRunCommand(getConnectionString(), "-f=ut_documentation_reporter", "-o=output.txt", "-s");

List<ReporterOptions> reporterOptionsList = runCmd.getReporterOptionsList();

Expand All @@ -74,7 +78,7 @@ public void reporterOptions_OneReporterForceScreen() {

@Test
public void reporterOptions_OneReporterForceScreenInverse() {
RunCommand runCmd = createRunCommand("app/app@xe", "-f=ut_documentation_reporter", "-s", "-o=output.txt");
RunCommand runCmd = createRunCommand(getConnectionString(), "-f=ut_documentation_reporter", "-s", "-o=output.txt");

List<ReporterOptions> reporterOptionsList = runCmd.getReporterOptionsList();

Expand All @@ -87,7 +91,7 @@ public void reporterOptions_OneReporterForceScreenInverse() {

@Test
public void reporterOptions_TwoReporters() {
RunCommand runCmd = createRunCommand("app/app@xe",
RunCommand runCmd = createRunCommand(getConnectionString(),
"-f=ut_documentation_reporter",
"-f=ut_coverage_html_reporter", "-o=coverage.html", "-s");

Expand All @@ -108,11 +112,14 @@ public void reporterOptions_TwoReporters() {

@Test
public void run_Default() {
RunCommand runCmd = createRunCommand(sUser + "/" + sPass + "@" + sUrl);
RunCommand runCmd = createRunCommand(getConnectionString(),
"-f=ut_documentation_reporter",
"-c",
"--failure-exit-code=2");

try {
int result = runCmd.run();
Assert.assertEquals(0, result);
Assert.assertEquals(2, result);
}
catch ( Exception e ) {
Assert.fail(e.getMessage());
Expand Down