forked from utPLSQL/utPLSQL-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunCommandTest.java
More file actions
95 lines (73 loc) · 4.06 KB
/
RunCommandTest.java
File metadata and controls
95 lines (73 loc) · 4.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package org.utplsql.cli;
import org.junit.jupiter.api.Test;
import org.utplsql.api.reporter.CoreReporters;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
/**
* Unit test for run command.
*/
class RunCommandTest {
@Test
void reporterOptions_Default() {
RunCommand runCmd = TestHelper.createRunCommand(TestHelper.getConnectionString());
List<ReporterOptions> reporterOptionsList = runCmd.getReporterOptionsList();
ReporterOptions reporterOptions1 = reporterOptionsList.get(0);
assertEquals(CoreReporters.UT_DOCUMENTATION_REPORTER.name(), reporterOptions1.getReporterName());
assertNull(reporterOptions1.getOutputFileName());
assertFalse(reporterOptions1.outputToFile());
assertTrue(reporterOptions1.outputToScreen());
}
@Test
void reporterOptions_OneReporter() {
RunCommand runCmd = TestHelper.createRunCommand(TestHelper.getConnectionString(), "-f=ut_documentation_reporter", "-o=output.txt");
List<ReporterOptions> reporterOptionsList = runCmd.getReporterOptionsList();
ReporterOptions reporterOptions1 = reporterOptionsList.get(0);
assertEquals(CoreReporters.UT_DOCUMENTATION_REPORTER.name(), reporterOptions1.getReporterName());
assertEquals(reporterOptions1.getOutputFileName(), "output.txt");
assertTrue(reporterOptions1.outputToFile());
assertFalse(reporterOptions1.outputToScreen());
}
@Test
void reporterOptions_OneReporterForceScreen() {
RunCommand runCmd = TestHelper.createRunCommand(TestHelper.getConnectionString(), "-f=ut_documentation_reporter", "-o=output.txt", "-s");
List<ReporterOptions> reporterOptionsList = runCmd.getReporterOptionsList();
ReporterOptions reporterOptions1 = reporterOptionsList.get(0);
assertEquals(CoreReporters.UT_DOCUMENTATION_REPORTER.name(), reporterOptions1.getReporterName());
assertEquals(reporterOptions1.getOutputFileName(), "output.txt");
assertTrue(reporterOptions1.outputToFile());
assertTrue(reporterOptions1.outputToScreen());
}
@Test
void reporterOptions_OneReporterForceScreenInverse() {
RunCommand runCmd = TestHelper.createRunCommand(TestHelper.getConnectionString(), "-f=ut_documentation_reporter", "-s", "-o=output.txt");
List<ReporterOptions> reporterOptionsList = runCmd.getReporterOptionsList();
ReporterOptions reporterOptions1 = reporterOptionsList.get(0);
assertEquals(CoreReporters.UT_DOCUMENTATION_REPORTER.name(), reporterOptions1.getReporterName());
assertEquals(reporterOptions1.getOutputFileName(), "output.txt");
assertTrue(reporterOptions1.outputToFile());
assertTrue(reporterOptions1.outputToScreen());
}
@Test
void reporterOptions_TwoReporters() {
RunCommand runCmd = TestHelper.createRunCommand(TestHelper.getConnectionString(),
"-f=ut_documentation_reporter",
"-f=ut_coverage_html_reporter", "-o=coverage.html", "-s");
List<ReporterOptions> reporterOptionsList = runCmd.getReporterOptionsList();
ReporterOptions reporterOptions1 = reporterOptionsList.get(0);
assertEquals(CoreReporters.UT_DOCUMENTATION_REPORTER.name(), reporterOptions1.getReporterName());
assertNull(reporterOptions1.getOutputFileName());
assertFalse(reporterOptions1.outputToFile());
assertTrue(reporterOptions1.outputToScreen());
ReporterOptions reporterOptions2 = reporterOptionsList.get(1);
assertEquals(CoreReporters.UT_COVERAGE_HTML_REPORTER.name(), reporterOptions2.getReporterName());
assertEquals(reporterOptions2.getOutputFileName(), "coverage.html");
assertTrue(reporterOptions2.outputToFile());
assertTrue(reporterOptions2.outputToScreen());
}
@Test
void connectionString_asSysdba() {
RunCommand runCmd = TestHelper.createRunCommand("sys as sysdba/mypass@connectstring/service");
assertEquals("sys as sysdba/mypass@connectstring/service",
runCmd.getConnectionInfo().getConnectionString());
}
}