slawekjaranowski commented on code in PR #345:
URL:
https://github.com/apache/maven-shared-utils/pull/345#discussion_r2624077660
##########
src/test/java/org/apache/maven/shared/utils/XmlStreamReaderTest.java:
##########
@@ -95,65 +96,79 @@ private static void checkXmlStreamReader(String text,
String encoding, String ef
checkXmlContent(xml, effectiveEncoding, bom);
}
+ @Test
public void testNoXmlHeader() throws IOException {
String xml = "<text>text with no XML header</text>";
checkXmlContent(xml, "UTF-8");
checkXmlContent(xml, "UTF-8", BOM_UTF8);
}
+ @Test
public void testDefaultEncoding() throws IOException {
checkXmlStreamReader(TEXT_UNICODE, null, "UTF-8");
checkXmlStreamReader(TEXT_UNICODE, null, "UTF-8", BOM_UTF8);
}
+ @Test
public void testUTF8Encoding() throws IOException {
checkXmlStreamReader(TEXT_UNICODE, "UTF-8");
checkXmlStreamReader(TEXT_UNICODE, "UTF-8", BOM_UTF8);
}
+ @Test
public void testUTF16Encoding() throws IOException {
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);
}
+ @Test
public void testUTF16BEEncoding() throws IOException {
checkXmlStreamReader(TEXT_UNICODE, "UTF-16BE");
}
+ @Test
public void testUTF16LEEncoding() throws IOException {
checkXmlStreamReader(TEXT_UNICODE, "UTF-16LE");
}
+ @Test
public void testLatin1Encoding() throws IOException {
checkXmlStreamReader(TEXT_LATIN1, "ISO-8859-1");
}
+ @Test
public void testLatin7Encoding() throws IOException {
checkXmlStreamReader(TEXT_LATIN7, "ISO-8859-7");
}
+ @Test
public void testLatin15Encoding() throws IOException {
checkXmlStreamReader(TEXT_LATIN15, "ISO-8859-15");
}
+ @Test
public void testEUCJPEncoding() throws IOException {
checkXmlStreamReader(TEXT_EUC_JP, "EUC-JP");
}
+ @Test
public void testEBCDICEncoding() throws IOException {
checkXmlStreamReader("simple text in EBCDIC", "CP1047");
}
+ @Test
public void testInappropriateEncoding() throws IOException {
- try {
- checkXmlStreamReader(TEXT_UNICODE, "ISO-8859-2");
- fail("Check should have failed, since some characters are not
available in the specified encoding");
- } catch (ComparisonFailure cf) {
- // expected failure, since the encoding does not contain some
characters
- }
+ // try {
+ // checkXmlStreamReader(TEXT_UNICODE, "ISO-8859-2");
+ // fail("Check should have failed, since some characters
are not available in the specified
+ // encoding");
+ // } catch (ComparisonFailure cf) {
+ // // expected failure, since the encoding does not contain
some characters
+ // }
Review Comment:
?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]