Skip to content

Commit 0512ae2

Browse files
1 parent 9a87e5c commit 0512ae2

13 files changed

+129
-142
lines changed

src/test/java/org/codehaus/plexus/util/xml/PrettyPrintXMLWriterTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ void testendElementAlreadyClosed() {
173173
*/
174174
@Disabled("This test is only relevant on JDK 1.7, which is not supported anymore")
175175
@Test
176-
void issue51DetectJava7ConcatenationBug() throws IOException {
176+
void issue51DetectJava7ConcatenationBug() throws Exception {
177177
File dir = new File("target/test-xml");
178178
if (!dir.exists()) {
179179
assertTrue(dir.mkdir(), "cannot create directory test-xml");

src/test/java/org/codehaus/plexus/util/xml/XmlStreamReaderTest.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ private static void checkXmlStreamReader(String text, String encoding, String ef
113113
* @throws java.io.IOException if any.
114114
*/
115115
@Test
116-
void noXmlHeader() throws IOException {
116+
void noXmlHeader() throws Exception {
117117
String xml = "<text>text with no XML header</text>";
118118
checkXmlContent(xml, "UTF-8");
119119
checkXmlContent(xml, "UTF-8", BOM_UTF8);
@@ -125,7 +125,7 @@ void noXmlHeader() throws IOException {
125125
* @throws java.io.IOException if any.
126126
*/
127127
@Test
128-
void defaultEncoding() throws IOException {
128+
void defaultEncoding() throws Exception {
129129
checkXmlStreamReader(TEXT_UNICODE, null, "UTF-8");
130130
checkXmlStreamReader(TEXT_UNICODE, null, "UTF-8", BOM_UTF8);
131131
}
@@ -136,7 +136,7 @@ void defaultEncoding() throws IOException {
136136
* @throws java.io.IOException if any.
137137
*/
138138
@Test
139-
void utf8Encoding() throws IOException {
139+
void utf8Encoding() throws Exception {
140140
checkXmlStreamReader(TEXT_UNICODE, "UTF-8");
141141
checkXmlStreamReader(TEXT_UNICODE, "UTF-8", BOM_UTF8);
142142
}
@@ -147,7 +147,7 @@ void utf8Encoding() throws IOException {
147147
* @throws java.io.IOException if any.
148148
*/
149149
@Test
150-
void utf16Encoding() throws IOException {
150+
void utf16Encoding() throws Exception {
151151
checkXmlStreamReader(TEXT_UNICODE, "UTF-16", "UTF-16BE", null);
152152
checkXmlStreamReader(TEXT_UNICODE, "UTF-16", "UTF-16LE", BOM_UTF16LE);
153153
checkXmlStreamReader(TEXT_UNICODE, "UTF-16", "UTF-16BE", BOM_UTF16BE);
@@ -159,7 +159,7 @@ void utf16Encoding() throws IOException {
159159
* @throws java.io.IOException if any.
160160
*/
161161
@Test
162-
void utf16beEncoding() throws IOException {
162+
void utf16beEncoding() throws Exception {
163163
checkXmlStreamReader(TEXT_UNICODE, "UTF-16BE");
164164
}
165165

@@ -169,7 +169,7 @@ void utf16beEncoding() throws IOException {
169169
* @throws java.io.IOException if any.
170170
*/
171171
@Test
172-
void utf16leEncoding() throws IOException {
172+
void utf16leEncoding() throws Exception {
173173
checkXmlStreamReader(TEXT_UNICODE, "UTF-16LE");
174174
}
175175

@@ -179,7 +179,7 @@ void utf16leEncoding() throws IOException {
179179
* @throws java.io.IOException if any.
180180
*/
181181
@Test
182-
void latin1Encoding() throws IOException {
182+
void latin1Encoding() throws Exception {
183183
checkXmlStreamReader(TEXT_LATIN1, "ISO-8859-1");
184184
}
185185

@@ -189,7 +189,7 @@ void latin1Encoding() throws IOException {
189189
* @throws java.io.IOException if any.
190190
*/
191191
@Test
192-
void latin7Encoding() throws IOException {
192+
void latin7Encoding() throws Exception {
193193
checkXmlStreamReader(TEXT_LATIN7, "ISO-8859-7");
194194
}
195195

@@ -199,7 +199,7 @@ void latin7Encoding() throws IOException {
199199
* @throws java.io.IOException if any.
200200
*/
201201
@Test
202-
void latin15Encoding() throws IOException {
202+
void latin15Encoding() throws Exception {
203203
checkXmlStreamReader(TEXT_LATIN15, "ISO-8859-15");
204204
}
205205

@@ -209,7 +209,7 @@ void latin15Encoding() throws IOException {
209209
* @throws java.io.IOException if any.
210210
*/
211211
@Test
212-
void euc_jpEncoding() throws IOException {
212+
void euc_jpEncoding() throws Exception {
213213
checkXmlStreamReader(TEXT_EUC_JP, "EUC-JP");
214214
}
215215

@@ -219,7 +219,7 @@ void euc_jpEncoding() throws IOException {
219219
* @throws java.io.IOException if any.
220220
*/
221221
@Test
222-
void ebcdicEncoding() throws IOException {
222+
void ebcdicEncoding() throws Exception {
223223
checkXmlStreamReader("simple text in EBCDIC", "CP1047");
224224
}
225225

@@ -242,7 +242,7 @@ void inappropriateEncoding() {
242242
* @throws java.io.IOException if any.
243243
*/
244244
@Test
245-
void encodingAttribute() throws IOException {
245+
void encodingAttribute() throws Exception {
246246
String xml = "<?xml version='1.0' encoding='US-ASCII'?><element encoding='attribute value'/>";
247247
checkXmlContent(xml, "US-ASCII");
248248

@@ -269,7 +269,7 @@ void encodingAttribute() throws IOException {
269269
* @throws java.io.IOException if any.
270270
*/
271271
@Test
272-
void encodingPatternWithManyAttributes() throws IOException {
272+
void encodingPatternWithManyAttributes() throws Exception {
273273
// Test with many attributes before encoding to ensure non-greedy matching works
274274
String xml = "<?xml version='1.0' a='1' b='2' c='3' d='4' e='5' encoding='UTF-8'?><root/>";
275275
checkXmlContent(xml, "UTF-8");

src/test/java/org/codehaus/plexus/util/xml/XmlStreamWriterTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private static void checkXmlWriter(String text, String encoding) throws IOExcept
7777
* @throws java.io.IOException if any.
7878
*/
7979
@Test
80-
void noXmlHeader() throws IOException {
80+
void noXmlHeader() throws Exception {
8181
String xml = "<text>text with no XML header</text>";
8282
checkXmlContent(xml, "UTF-8");
8383
}
@@ -88,7 +88,7 @@ void noXmlHeader() throws IOException {
8888
* @throws java.io.IOException if any.
8989
*/
9090
@Test
91-
void empty() throws IOException {
91+
void empty() throws Exception {
9292
ByteArrayOutputStream out = new ByteArrayOutputStream();
9393
XmlStreamWriter writer = new XmlStreamWriter(out);
9494
writer.flush();
@@ -105,7 +105,7 @@ void empty() throws IOException {
105105
* @throws java.io.IOException if any.
106106
*/
107107
@Test
108-
void defaultEncoding() throws IOException {
108+
void defaultEncoding() throws Exception {
109109
checkXmlWriter(TEXT_UNICODE, null);
110110
}
111111

@@ -115,7 +115,7 @@ void defaultEncoding() throws IOException {
115115
* @throws java.io.IOException if any.
116116
*/
117117
@Test
118-
void utf8Encoding() throws IOException {
118+
void utf8Encoding() throws Exception {
119119
checkXmlWriter(TEXT_UNICODE, "UTF-8");
120120
}
121121

@@ -125,7 +125,7 @@ void utf8Encoding() throws IOException {
125125
* @throws java.io.IOException if any.
126126
*/
127127
@Test
128-
void utf16Encoding() throws IOException {
128+
void utf16Encoding() throws Exception {
129129
checkXmlWriter(TEXT_UNICODE, "UTF-16");
130130
}
131131

@@ -135,7 +135,7 @@ void utf16Encoding() throws IOException {
135135
* @throws java.io.IOException if any.
136136
*/
137137
@Test
138-
void utf16beEncoding() throws IOException {
138+
void utf16beEncoding() throws Exception {
139139
checkXmlWriter(TEXT_UNICODE, "UTF-16BE");
140140
}
141141

@@ -145,7 +145,7 @@ void utf16beEncoding() throws IOException {
145145
* @throws java.io.IOException if any.
146146
*/
147147
@Test
148-
void utf16leEncoding() throws IOException {
148+
void utf16leEncoding() throws Exception {
149149
checkXmlWriter(TEXT_UNICODE, "UTF-16LE");
150150
}
151151

@@ -155,7 +155,7 @@ void utf16leEncoding() throws IOException {
155155
* @throws java.io.IOException if any.
156156
*/
157157
@Test
158-
void latin1Encoding() throws IOException {
158+
void latin1Encoding() throws Exception {
159159
checkXmlWriter(TEXT_LATIN1, "ISO-8859-1");
160160
}
161161

@@ -165,7 +165,7 @@ void latin1Encoding() throws IOException {
165165
* @throws java.io.IOException if any.
166166
*/
167167
@Test
168-
void latin7Encoding() throws IOException {
168+
void latin7Encoding() throws Exception {
169169
checkXmlWriter(TEXT_LATIN7, "ISO-8859-7");
170170
}
171171

@@ -175,7 +175,7 @@ void latin7Encoding() throws IOException {
175175
* @throws java.io.IOException if any.
176176
*/
177177
@Test
178-
void latin15Encoding() throws IOException {
178+
void latin15Encoding() throws Exception {
179179
checkXmlWriter(TEXT_LATIN15, "ISO-8859-15");
180180
}
181181

@@ -185,7 +185,7 @@ void latin15Encoding() throws IOException {
185185
* @throws java.io.IOException if any.
186186
*/
187187
@Test
188-
void euc_jpEncoding() throws IOException {
188+
void euc_jpEncoding() throws Exception {
189189
checkXmlWriter(TEXT_EUC_JP, "EUC-JP");
190190
}
191191

@@ -195,7 +195,7 @@ void euc_jpEncoding() throws IOException {
195195
* @throws java.io.IOException if any.
196196
*/
197197
@Test
198-
void ebcdicEncoding() throws IOException {
198+
void ebcdicEncoding() throws Exception {
199199
checkXmlWriter("simple text in EBCDIC", "CP1047");
200200
}
201201
}

src/test/java/org/codehaus/plexus/util/xml/Xpp3DomBuilderTest.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,7 @@ void unclosedXml() {
128128
try {
129129
Xpp3DomBuilder.build(new StringReader(domString));
130130
} catch (XmlPullParserException expected) {
131-
// correct
132-
assertTrue(true);
133131
} catch (IOException expected) {
134-
// this will do too
135-
assertTrue(true);
136132
}
137133
}
138134

@@ -143,7 +139,7 @@ void unclosedXml() {
143139
* @throws org.codehaus.plexus.util.xml.pull.XmlPullParserException if any.
144140
*/
145141
@Test
146-
void escapingInContent() throws IOException, XmlPullParserException {
142+
void escapingInContent() throws Exception {
147143
Xpp3Dom dom = Xpp3DomBuilder.build(new StringReader(getEncodedString()));
148144

149145
assertEquals("\"text\"", dom.getChild("el").getValue(), "Check content value");
@@ -162,7 +158,7 @@ void escapingInContent() throws IOException, XmlPullParserException {
162158
* @throws org.codehaus.plexus.util.xml.pull.XmlPullParserException if any.
163159
*/
164160
@Test
165-
void escapingInAttributes() throws IOException, XmlPullParserException {
161+
void escapingInAttributes() throws Exception {
166162
String s = getAttributeEncodedString();
167163
Xpp3Dom dom = Xpp3DomBuilder.build(new StringReader(s));
168164

@@ -181,7 +177,7 @@ void escapingInAttributes() throws IOException, XmlPullParserException {
181177
* @throws org.codehaus.plexus.util.xml.pull.XmlPullParserException if any.
182178
*/
183179
@Test
184-
void inputLocationTracking() throws IOException, XmlPullParserException {
180+
void inputLocationTracking() throws Exception {
185181
Xpp3DomBuilder.InputLocationBuilder ilb = new Xpp3DomBuilder.InputLocationBuilder() {
186182
public Object toInputLocation(XmlPullParser parser) {
187183
return parser.getLineNumber(); // store only line number as a simple Integer

src/test/java/org/codehaus/plexus/util/xml/Xpp3DomTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ void equals() {
220220
* @throws java.io.IOException if any.
221221
*/
222222
@Test
223-
void equalsIsNullSafe() throws XmlPullParserException, IOException {
223+
void equalsIsNullSafe() throws Exception {
224224
String testDom = "<configuration><items thing='blah'><item>one</item><item>two</item></items></configuration>";
225225
Xpp3Dom dom = Xpp3DomBuilder.build(new StringReader(testDom));
226226

@@ -242,7 +242,7 @@ void equalsIsNullSafe() throws XmlPullParserException, IOException {
242242
* @throws java.io.IOException if any.
243243
*/
244244
@Test
245-
void shouldOverwritePluginConfigurationSubItemsByDefault() throws XmlPullParserException, IOException {
245+
void shouldOverwritePluginConfigurationSubItemsByDefault() throws Exception {
246246
String parentConfigStr = "<configuration><items><item>one</item><item>two</item></items></configuration>";
247247
Xpp3Dom parentConfig =
248248
Xpp3DomBuilder.build(new StringReader(parentConfigStr), new FixedInputLocationBuilder("parent"));
@@ -268,7 +268,7 @@ void shouldOverwritePluginConfigurationSubItemsByDefault() throws XmlPullParserE
268268
* @throws java.io.IOException if any.
269269
*/
270270
@Test
271-
void shouldMergePluginConfigurationSubItemsWithMergeAttributeSet() throws XmlPullParserException, IOException {
271+
void shouldMergePluginConfigurationSubItemsWithMergeAttributeSet() throws Exception {
272272
String parentConfigStr = "<configuration><items><item>one</item><item>two</item></items></configuration>";
273273
Xpp3Dom parentConfig =
274274
Xpp3DomBuilder.build(new StringReader(parentConfigStr), new FixedInputLocationBuilder("parent"));
@@ -342,7 +342,7 @@ void shouldCopyRecessiveChildrenNotPresentInTarget() throws Exception {
342342
* @throws org.codehaus.plexus.util.xml.pull.XmlPullParserException if any.
343343
*/
344344
@Test
345-
void dupeChildren() throws IOException, XmlPullParserException {
345+
void dupeChildren() throws Exception {
346346
String dupes = "<configuration><foo>x</foo><foo>y</foo></configuration>";
347347
Xpp3Dom dom = Xpp3DomBuilder.build(new StringReader(dupes));
348348
assertNotNull(dom);
@@ -482,7 +482,7 @@ void combineKeys() throws Exception {
482482
}
483483

484484
@Test
485-
void preserveDominantBlankValue() throws XmlPullParserException, IOException {
485+
void preserveDominantBlankValue() throws Exception {
486486
String lhs = "<parameter xml:space=\"preserve\"> </parameter>";
487487

488488
String rhs = "<parameter>recessive</parameter>";
@@ -497,7 +497,7 @@ void preserveDominantBlankValue() throws XmlPullParserException, IOException {
497497
}
498498

499499
@Test
500-
void preserveDominantEmptyNode() throws XmlPullParserException, IOException {
500+
void preserveDominantEmptyNode() throws Exception {
501501
String lhs = "<parameter></parameter>";
502502

503503
String rhs = "<parameter>recessive</parameter>";

0 commit comments

Comments
 (0)