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
99 lines (76 loc) · 4.02 KB
/
RunCommandTest.java
File metadata and controls
99 lines (76 loc) · 4.02 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
96
97
98
99
package org.utplsql.cli;
import com.beust.jcommander.JCommander;
import org.junit.Assert;
import org.junit.Test;
import org.utplsql.api.CustomTypes;
import java.util.List;
/**
* Unit test for run command.
*/
public class RunCommandTest {
private RunCommand createRunCommand(String... args) {
RunCommand runCmd = new RunCommand();
JCommander.newBuilder()
.addObject(runCmd)
.args(args)
.build();
return runCmd;
}
@Test
public void reporterOptions_Default() {
RunCommand runCmd = createRunCommand("app/app@xe");
List<ReporterOptions> reporterOptionsList = runCmd.getReporterOptionsList();
ReporterOptions reporterOptions1 = reporterOptionsList.get(0);
Assert.assertEquals(CustomTypes.UT_DOCUMENTATION_REPORTER, reporterOptions1.getReporterName());
Assert.assertNull(reporterOptions1.getOutputFileName());
Assert.assertFalse(reporterOptions1.outputToFile());
Assert.assertTrue(reporterOptions1.outputToScreen());
}
@Test
public void reporterOptions_OneReporter() {
RunCommand runCmd = createRunCommand("app/app@xe", "-f=ut_documentation_reporter", "-o=output.txt");
List<ReporterOptions> reporterOptionsList = runCmd.getReporterOptionsList();
ReporterOptions reporterOptions1 = reporterOptionsList.get(0);
Assert.assertEquals(CustomTypes.UT_DOCUMENTATION_REPORTER, reporterOptions1.getReporterName());
Assert.assertEquals(reporterOptions1.getOutputFileName(), "output.txt");
Assert.assertTrue(reporterOptions1.outputToFile());
Assert.assertFalse(reporterOptions1.outputToScreen());
}
@Test
public void reporterOptions_OneReporterForceScreen() {
RunCommand runCmd = createRunCommand("app/app@xe", "-f=ut_documentation_reporter", "-o=output.txt", "-s");
List<ReporterOptions> reporterOptionsList = runCmd.getReporterOptionsList();
ReporterOptions reporterOptions1 = reporterOptionsList.get(0);
Assert.assertEquals(CustomTypes.UT_DOCUMENTATION_REPORTER, reporterOptions1.getReporterName());
Assert.assertEquals(reporterOptions1.getOutputFileName(), "output.txt");
Assert.assertTrue(reporterOptions1.outputToFile());
Assert.assertTrue(reporterOptions1.outputToScreen());
}
@Test
public void reporterOptions_OneReporterForceScreenInverse() {
RunCommand runCmd = createRunCommand("app/app@xe", "-f=ut_documentation_reporter", "-s", "-o=output.txt");
List<ReporterOptions> reporterOptionsList = runCmd.getReporterOptionsList();
ReporterOptions reporterOptions1 = reporterOptionsList.get(0);
Assert.assertEquals(CustomTypes.UT_DOCUMENTATION_REPORTER, reporterOptions1.getReporterName());
Assert.assertEquals(reporterOptions1.getOutputFileName(), "output.txt");
Assert.assertTrue(reporterOptions1.outputToFile());
Assert.assertTrue(reporterOptions1.outputToScreen());
}
@Test
public void reporterOptions_TwoReporters() {
RunCommand runCmd = createRunCommand("app/app@xe",
"-f=ut_documentation_reporter",
"-f=ut_coverage_html_reporter", "-o=coverage.html", "-s");
List<ReporterOptions> reporterOptionsList = runCmd.getReporterOptionsList();
ReporterOptions reporterOptions1 = reporterOptionsList.get(0);
Assert.assertEquals(CustomTypes.UT_DOCUMENTATION_REPORTER, reporterOptions1.getReporterName());
Assert.assertNull(reporterOptions1.getOutputFileName());
Assert.assertFalse(reporterOptions1.outputToFile());
Assert.assertTrue(reporterOptions1.outputToScreen());
ReporterOptions reporterOptions2 = reporterOptionsList.get(1);
Assert.assertEquals(CustomTypes.UT_COVERAGE_HTML_REPORTER, reporterOptions2.getReporterName());
Assert.assertEquals(reporterOptions2.getOutputFileName(), "coverage.html");
Assert.assertTrue(reporterOptions2.outputToFile());
Assert.assertTrue(reporterOptions2.outputToScreen());
}
}