13
13
*/
14
14
public class RunCommandTest {
15
15
16
- private static String sUrl ;
17
- private static String sUser ;
18
- private static String sPass ;
19
-
20
- static {
21
- sUrl = System .getenv ("DB_URL" ) != null ? System .getenv ("DB_URL" ) : "192.168.99.100:1521:XE" ;
22
- sUser = System .getenv ("DB_USER" ) != null ? System .getenv ("DB_USER" ) : "app" ;
23
- sPass = System .getenv ("DB_PASS" ) != null ? System .getenv ("DB_PASS" ) : "app" ;
24
- }
25
-
26
- private RunCommand createRunCommand (String ... args ) {
27
- RunCommand runCmd = new RunCommand ();
28
-
29
- JCommander .newBuilder ()
30
- .addObject (runCmd )
31
- .args (args )
32
- .build ();
33
-
34
- return runCmd ;
35
- }
36
-
37
- private String getConnectionString () {
38
- return sUser + "/" + sPass + "@" + sUrl ;
39
- }
40
-
41
16
@ Test
42
17
public void reporterOptions_Default () {
43
- RunCommand runCmd = createRunCommand (getConnectionString ());
18
+ RunCommand runCmd = RunCommandTestHelper . createRunCommand (RunCommandTestHelper . getConnectionString ());
44
19
45
20
List <ReporterOptions > reporterOptionsList = runCmd .getReporterOptionsList ();
46
21
@@ -53,7 +28,7 @@ public void reporterOptions_Default() {
53
28
54
29
@ Test
55
30
public void reporterOptions_OneReporter () {
56
- RunCommand runCmd = createRunCommand (getConnectionString (), "-f=ut_documentation_reporter" , "-o=output.txt" );
31
+ RunCommand runCmd = RunCommandTestHelper . createRunCommand (RunCommandTestHelper . getConnectionString (), "-f=ut_documentation_reporter" , "-o=output.txt" );
57
32
58
33
List <ReporterOptions > reporterOptionsList = runCmd .getReporterOptionsList ();
59
34
@@ -66,7 +41,7 @@ public void reporterOptions_OneReporter() {
66
41
67
42
@ Test
68
43
public void reporterOptions_OneReporterForceScreen () {
69
- RunCommand runCmd = createRunCommand (getConnectionString (), "-f=ut_documentation_reporter" , "-o=output.txt" , "-s" );
44
+ RunCommand runCmd = RunCommandTestHelper . createRunCommand (RunCommandTestHelper . getConnectionString (), "-f=ut_documentation_reporter" , "-o=output.txt" , "-s" );
70
45
71
46
List <ReporterOptions > reporterOptionsList = runCmd .getReporterOptionsList ();
72
47
@@ -79,7 +54,7 @@ public void reporterOptions_OneReporterForceScreen() {
79
54
80
55
@ Test
81
56
public void reporterOptions_OneReporterForceScreenInverse () {
82
- RunCommand runCmd = createRunCommand (getConnectionString (), "-f=ut_documentation_reporter" , "-s" , "-o=output.txt" );
57
+ RunCommand runCmd = RunCommandTestHelper . createRunCommand (RunCommandTestHelper . getConnectionString (), "-f=ut_documentation_reporter" , "-s" , "-o=output.txt" );
83
58
84
59
List <ReporterOptions > reporterOptionsList = runCmd .getReporterOptionsList ();
85
60
@@ -92,7 +67,7 @@ public void reporterOptions_OneReporterForceScreenInverse() {
92
67
93
68
@ Test
94
69
public void reporterOptions_TwoReporters () {
95
- RunCommand runCmd = createRunCommand (getConnectionString (),
70
+ RunCommand runCmd = RunCommandTestHelper . createRunCommand (RunCommandTestHelper . getConnectionString (),
96
71
"-f=ut_documentation_reporter" ,
97
72
"-f=ut_coverage_html_reporter" , "-o=coverage.html" , "-s" );
98
73
@@ -111,25 +86,4 @@ public void reporterOptions_TwoReporters() {
111
86
Assert .assertTrue (reporterOptions2 .outputToScreen ());
112
87
}
113
88
114
- @ Test
115
- public void run_Default () {
116
- RunCommand runCmd = createRunCommand (getConnectionString (),
117
- "-f=ut_documentation_reporter" ,
118
- "-c" ,
119
- "--failure-exit-code=2" );
120
-
121
- try {
122
- int result = runCmd .run ();
123
-
124
- // Only expect failure-exit-code to work on several framework versions
125
- if (OptionalFeatures .FAIL_ON_ERROR .isAvailableFor (runCmd .getDatabaseVersion ()) )
126
- Assert .assertEquals (2 , result );
127
- else
128
- Assert .assertEquals (0 , result );
129
- }
130
- catch ( Exception e ) {
131
- Assert .fail (e .getMessage ());
132
- }
133
- }
134
-
135
89
}
0 commit comments