1
1
package org .utplsql .api ;
2
2
3
3
import org .junit .jupiter .api .Test ;
4
+ import org .utplsql .api .compatibility .CompatibilityProxy ;
5
+ import org .utplsql .api .exception .InvalidVersionException ;
4
6
import org .utplsql .api .reporter .CoreReporters ;
5
7
import org .utplsql .api .reporter .DefaultReporter ;
6
8
import org .utplsql .api .reporter .DocumentationReporter ;
9
11
import java .io .File ;
10
12
import java .io .FileOutputStream ;
11
13
import java .io .PrintStream ;
14
+ import java .nio .charset .Charset ;
12
15
import java .sql .SQLException ;
13
16
import java .util .ArrayList ;
14
17
import java .util .List ;
@@ -106,7 +109,7 @@ public void fetchAllLines() throws SQLException {
106
109
}
107
110
108
111
@ Test
109
- public void getOutputFromSonarReporter () throws SQLException {
112
+ public void getOutputFromSonarReporter () throws SQLException , InvalidVersionException {
110
113
Reporter reporter = new DefaultReporter (CoreReporters .UT_SONAR_TEST_REPORTER .name (), null ).init (newConnection ());
111
114
112
115
new TestRunner ()
@@ -119,4 +122,23 @@ public void getOutputFromSonarReporter() throws SQLException {
119
122
assertTrue (outputLines .size () > 0 );
120
123
}
121
124
125
+ @ Test
126
+ public void sonarReporterHasEncodingSet () throws SQLException , InvalidVersionException {
127
+ CompatibilityProxy proxy = new CompatibilityProxy (newConnection ());
128
+
129
+ if ( proxy .getDatabaseVersion ().isGreaterOrEqualThan (new Version ("3.1.2" ))) {
130
+ Reporter reporter = new DefaultReporter (CoreReporters .UT_SONAR_TEST_REPORTER .name (), null ).init (getConnection ());
131
+
132
+ TestRunner tr = new TestRunner ()
133
+ .addPath (getUser ())
134
+ .addReporter (reporter );
135
+
136
+ tr .run (getConnection ());
137
+
138
+ List <String > outputLines = reporter .getOutputBuffer ().fetchAll (getConnection ());
139
+
140
+ assertTrue (outputLines .get (0 ).contains ("encoding=\" " + Charset .defaultCharset ().toString () + "\" " ));
141
+ }
142
+
143
+ }
122
144
}
0 commit comments