23
23
24
24
import org .codehaus .plexus .util .IOUtil ;
25
25
26
- import junit .framework .ComparisonFailure ;
27
- import junit .framework .TestCase ;
26
+ import org .junit .jupiter .api .Test ;
27
+ import org .opentest4j .AssertionFailedError ;
28
+
29
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
30
+ import static org .junit .jupiter .api .Assertions .assertThrows ;
31
+ import static org .junit .jupiter .api .Assertions .fail ;
28
32
29
33
/**
30
34
* <p>XmlStreamReaderTest class.</p>
34
38
* @since 3.4.0
35
39
*/
36
40
public class XmlStreamReaderTest
37
- extends TestCase
38
41
{
39
42
/** french */
40
43
private static final String TEXT_LATIN1 = "eacute: \u00E9 " ;
@@ -127,6 +130,7 @@ private static void checkXmlStreamReader( String text, String encoding, String e
127
130
*
128
131
* @throws java.io.IOException if any.
129
132
*/
133
+ @ Test
130
134
public void testNoXmlHeader ()
131
135
throws IOException
132
136
{
@@ -140,6 +144,7 @@ public void testNoXmlHeader()
140
144
*
141
145
* @throws java.io.IOException if any.
142
146
*/
147
+ @ Test
143
148
public void testDefaultEncoding ()
144
149
throws IOException
145
150
{
@@ -152,6 +157,7 @@ public void testDefaultEncoding()
152
157
*
153
158
* @throws java.io.IOException if any.
154
159
*/
160
+ @ Test
155
161
public void testUTF8Encoding ()
156
162
throws IOException
157
163
{
@@ -164,6 +170,7 @@ public void testUTF8Encoding()
164
170
*
165
171
* @throws java.io.IOException if any.
166
172
*/
173
+ @ Test
167
174
public void testUTF16Encoding ()
168
175
throws IOException
169
176
{
@@ -177,6 +184,7 @@ public void testUTF16Encoding()
177
184
*
178
185
* @throws java.io.IOException if any.
179
186
*/
187
+ @ Test
180
188
public void testUTF16BEEncoding ()
181
189
throws IOException
182
190
{
@@ -188,6 +196,7 @@ public void testUTF16BEEncoding()
188
196
*
189
197
* @throws java.io.IOException if any.
190
198
*/
199
+ @ Test
191
200
public void testUTF16LEEncoding ()
192
201
throws IOException
193
202
{
@@ -199,6 +208,7 @@ public void testUTF16LEEncoding()
199
208
*
200
209
* @throws java.io.IOException if any.
201
210
*/
211
+ @ Test
202
212
public void testLatin1Encoding ()
203
213
throws IOException
204
214
{
@@ -210,6 +220,7 @@ public void testLatin1Encoding()
210
220
*
211
221
* @throws java.io.IOException if any.
212
222
*/
223
+ @ Test
213
224
public void testLatin7Encoding ()
214
225
throws IOException
215
226
{
@@ -221,6 +232,7 @@ public void testLatin7Encoding()
221
232
*
222
233
* @throws java.io.IOException if any.
223
234
*/
235
+ @ Test
224
236
public void testLatin15Encoding ()
225
237
throws IOException
226
238
{
@@ -232,6 +244,7 @@ public void testLatin15Encoding()
232
244
*
233
245
* @throws java.io.IOException if any.
234
246
*/
247
+ @ Test
235
248
public void testEUC_JPEncoding ()
236
249
throws IOException
237
250
{
@@ -243,6 +256,7 @@ public void testEUC_JPEncoding()
243
256
*
244
257
* @throws java.io.IOException if any.
245
258
*/
259
+ @ Test
246
260
public void testEBCDICEncoding ()
247
261
throws IOException
248
262
{
@@ -254,25 +268,23 @@ public void testEBCDICEncoding()
254
268
*
255
269
* @throws java.io.IOException if any.
256
270
*/
271
+ @ Test
257
272
public void testInappropriateEncoding ()
258
273
throws IOException
259
274
{
260
- try
261
- {
262
- checkXmlStreamReader ( TEXT_UNICODE , "ISO-8859-2" );
263
- fail ( "Check should have failed, since some characters are not available in the specified encoding" );
264
- }
265
- catch ( ComparisonFailure cf )
266
- {
267
- // expected failure, since the encoding does not contain some characters
268
- }
275
+ // expected failure, since the encoding does not contain some characters
276
+ assertThrows (AssertionFailedError .class , () ->
277
+ checkXmlStreamReader ( TEXT_UNICODE , "ISO-8859-2" ),
278
+ "Check should have failed, since some characters are not available in the specified encoding"
279
+ );
269
280
}
270
281
271
282
/**
272
283
* <p>testEncodingAttribute.</p>
273
284
*
274
285
* @throws java.io.IOException if any.
275
286
*/
287
+ @ Test
276
288
public void testEncodingAttribute ()
277
289
throws IOException
278
290
{
0 commit comments