Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void testendElementAlreadyClosed() {
*/
@Disabled("This test is only relevant on JDK 1.7, which is not supported anymore")
@Test
void issue51DetectJava7ConcatenationBug() throws IOException {
void issue51DetectJava7ConcatenationBug() throws Exception {
File dir = new File("target/test-xml");
if (!dir.exists()) {
assertTrue(dir.mkdir(), "cannot create directory test-xml");
Expand Down
26 changes: 13 additions & 13 deletions src/test/java/org/codehaus/plexus/util/xml/XmlStreamReaderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private static void checkXmlStreamReader(String text, String encoding, String ef
* @throws java.io.IOException if any.
*/
@Test
void noXmlHeader() throws IOException {
void noXmlHeader() throws Exception {
String xml = "<text>text with no XML header</text>";
checkXmlContent(xml, "UTF-8");
checkXmlContent(xml, "UTF-8", BOM_UTF8);
Expand All @@ -125,7 +125,7 @@ void noXmlHeader() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void defaultEncoding() throws IOException {
void defaultEncoding() throws Exception {
checkXmlStreamReader(TEXT_UNICODE, null, "UTF-8");
checkXmlStreamReader(TEXT_UNICODE, null, "UTF-8", BOM_UTF8);
}
Expand All @@ -136,7 +136,7 @@ void defaultEncoding() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void utf8Encoding() throws IOException {
void utf8Encoding() throws Exception {
checkXmlStreamReader(TEXT_UNICODE, "UTF-8");
checkXmlStreamReader(TEXT_UNICODE, "UTF-8", BOM_UTF8);
}
Expand All @@ -147,7 +147,7 @@ void utf8Encoding() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void utf16Encoding() throws IOException {
void utf16Encoding() throws Exception {
checkXmlStreamReader(TEXT_UNICODE, "UTF-16", "UTF-16BE", null);
checkXmlStreamReader(TEXT_UNICODE, "UTF-16", "UTF-16LE", BOM_UTF16LE);
checkXmlStreamReader(TEXT_UNICODE, "UTF-16", "UTF-16BE", BOM_UTF16BE);
Expand All @@ -159,7 +159,7 @@ void utf16Encoding() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void utf16beEncoding() throws IOException {
void utf16beEncoding() throws Exception {
checkXmlStreamReader(TEXT_UNICODE, "UTF-16BE");
}

Expand All @@ -169,7 +169,7 @@ void utf16beEncoding() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void utf16leEncoding() throws IOException {
void utf16leEncoding() throws Exception {
checkXmlStreamReader(TEXT_UNICODE, "UTF-16LE");
}

Expand All @@ -179,7 +179,7 @@ void utf16leEncoding() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void latin1Encoding() throws IOException {
void latin1Encoding() throws Exception {
checkXmlStreamReader(TEXT_LATIN1, "ISO-8859-1");
}

Expand All @@ -189,7 +189,7 @@ void latin1Encoding() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void latin7Encoding() throws IOException {
void latin7Encoding() throws Exception {
checkXmlStreamReader(TEXT_LATIN7, "ISO-8859-7");
}

Expand All @@ -199,7 +199,7 @@ void latin7Encoding() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void latin15Encoding() throws IOException {
void latin15Encoding() throws Exception {
checkXmlStreamReader(TEXT_LATIN15, "ISO-8859-15");
}

Expand All @@ -209,7 +209,7 @@ void latin15Encoding() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void euc_jpEncoding() throws IOException {
void euc_jpEncoding() throws Exception {
checkXmlStreamReader(TEXT_EUC_JP, "EUC-JP");
}

Expand All @@ -219,7 +219,7 @@ void euc_jpEncoding() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void ebcdicEncoding() throws IOException {
void ebcdicEncoding() throws Exception {
checkXmlStreamReader("simple text in EBCDIC", "CP1047");
}

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

Expand All @@ -269,7 +269,7 @@ void encodingAttribute() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void encodingPatternWithManyAttributes() throws IOException {
void encodingPatternWithManyAttributes() throws Exception {
// Test with many attributes before encoding to ensure non-greedy matching works
String xml = "<?xml version='1.0' a='1' b='2' c='3' d='4' e='5' encoding='UTF-8'?><root/>";
checkXmlContent(xml, "UTF-8");
Expand Down
24 changes: 12 additions & 12 deletions src/test/java/org/codehaus/plexus/util/xml/XmlStreamWriterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private static void checkXmlWriter(String text, String encoding) throws IOExcept
* @throws java.io.IOException if any.
*/
@Test
void noXmlHeader() throws IOException {
void noXmlHeader() throws Exception {
String xml = "<text>text with no XML header</text>";
checkXmlContent(xml, "UTF-8");
}
Expand All @@ -88,7 +88,7 @@ void noXmlHeader() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void empty() throws IOException {
void empty() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
XmlStreamWriter writer = new XmlStreamWriter(out);
writer.flush();
Expand All @@ -105,7 +105,7 @@ void empty() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void defaultEncoding() throws IOException {
void defaultEncoding() throws Exception {
checkXmlWriter(TEXT_UNICODE, null);
}

Expand All @@ -115,7 +115,7 @@ void defaultEncoding() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void utf8Encoding() throws IOException {
void utf8Encoding() throws Exception {
checkXmlWriter(TEXT_UNICODE, "UTF-8");
}

Expand All @@ -125,7 +125,7 @@ void utf8Encoding() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void utf16Encoding() throws IOException {
void utf16Encoding() throws Exception {
checkXmlWriter(TEXT_UNICODE, "UTF-16");
}

Expand All @@ -135,7 +135,7 @@ void utf16Encoding() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void utf16beEncoding() throws IOException {
void utf16beEncoding() throws Exception {
checkXmlWriter(TEXT_UNICODE, "UTF-16BE");
}

Expand All @@ -145,7 +145,7 @@ void utf16beEncoding() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void utf16leEncoding() throws IOException {
void utf16leEncoding() throws Exception {
checkXmlWriter(TEXT_UNICODE, "UTF-16LE");
}

Expand All @@ -155,7 +155,7 @@ void utf16leEncoding() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void latin1Encoding() throws IOException {
void latin1Encoding() throws Exception {
checkXmlWriter(TEXT_LATIN1, "ISO-8859-1");
}

Expand All @@ -165,7 +165,7 @@ void latin1Encoding() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void latin7Encoding() throws IOException {
void latin7Encoding() throws Exception {
checkXmlWriter(TEXT_LATIN7, "ISO-8859-7");
}

Expand All @@ -175,7 +175,7 @@ void latin7Encoding() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void latin15Encoding() throws IOException {
void latin15Encoding() throws Exception {
checkXmlWriter(TEXT_LATIN15, "ISO-8859-15");
}

Expand All @@ -185,7 +185,7 @@ void latin15Encoding() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void euc_jpEncoding() throws IOException {
void euc_jpEncoding() throws Exception {
checkXmlWriter(TEXT_EUC_JP, "EUC-JP");
}

Expand All @@ -195,7 +195,7 @@ void euc_jpEncoding() throws IOException {
* @throws java.io.IOException if any.
*/
@Test
void ebcdicEncoding() throws IOException {
void ebcdicEncoding() throws Exception {
checkXmlWriter("simple text in EBCDIC", "CP1047");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,7 @@ void unclosedXml() {
try {
Xpp3DomBuilder.build(new StringReader(domString));
} catch (XmlPullParserException expected) {
// correct
assertTrue(true);
} catch (IOException expected) {
// this will do too
assertTrue(true);
}
}

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

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

Expand All @@ -181,7 +177,7 @@ void escapingInAttributes() throws IOException, XmlPullParserException {
* @throws org.codehaus.plexus.util.xml.pull.XmlPullParserException if any.
*/
@Test
void inputLocationTracking() throws IOException, XmlPullParserException {
void inputLocationTracking() throws Exception {
Xpp3DomBuilder.InputLocationBuilder ilb = new Xpp3DomBuilder.InputLocationBuilder() {
public Object toInputLocation(XmlPullParser parser) {
return parser.getLineNumber(); // store only line number as a simple Integer
Expand Down
12 changes: 6 additions & 6 deletions src/test/java/org/codehaus/plexus/util/xml/Xpp3DomTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ void equals() {
* @throws java.io.IOException if any.
*/
@Test
void equalsIsNullSafe() throws XmlPullParserException, IOException {
void equalsIsNullSafe() throws Exception {
String testDom = "<configuration><items thing='blah'><item>one</item><item>two</item></items></configuration>";
Xpp3Dom dom = Xpp3DomBuilder.build(new StringReader(testDom));

Expand All @@ -242,7 +242,7 @@ void equalsIsNullSafe() throws XmlPullParserException, IOException {
* @throws java.io.IOException if any.
*/
@Test
void shouldOverwritePluginConfigurationSubItemsByDefault() throws XmlPullParserException, IOException {
void shouldOverwritePluginConfigurationSubItemsByDefault() throws Exception {
String parentConfigStr = "<configuration><items><item>one</item><item>two</item></items></configuration>";
Xpp3Dom parentConfig =
Xpp3DomBuilder.build(new StringReader(parentConfigStr), new FixedInputLocationBuilder("parent"));
Expand All @@ -268,7 +268,7 @@ void shouldOverwritePluginConfigurationSubItemsByDefault() throws XmlPullParserE
* @throws java.io.IOException if any.
*/
@Test
void shouldMergePluginConfigurationSubItemsWithMergeAttributeSet() throws XmlPullParserException, IOException {
void shouldMergePluginConfigurationSubItemsWithMergeAttributeSet() throws Exception {
String parentConfigStr = "<configuration><items><item>one</item><item>two</item></items></configuration>";
Xpp3Dom parentConfig =
Xpp3DomBuilder.build(new StringReader(parentConfigStr), new FixedInputLocationBuilder("parent"));
Expand Down Expand Up @@ -342,7 +342,7 @@ void shouldCopyRecessiveChildrenNotPresentInTarget() throws Exception {
* @throws org.codehaus.plexus.util.xml.pull.XmlPullParserException if any.
*/
@Test
void dupeChildren() throws IOException, XmlPullParserException {
void dupeChildren() throws Exception {
String dupes = "<configuration><foo>x</foo><foo>y</foo></configuration>";
Xpp3Dom dom = Xpp3DomBuilder.build(new StringReader(dupes));
assertNotNull(dom);
Expand Down Expand Up @@ -482,7 +482,7 @@ void combineKeys() throws Exception {
}

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

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

@Test
void preserveDominantEmptyNode() throws XmlPullParserException, IOException {
void preserveDominantEmptyNode() throws Exception {
String lhs = "<parameter></parameter>";

String rhs = "<parameter>recessive</parameter>";
Expand Down
Loading
Loading