OWL-Varun commented on code in PR #821:
URL: https://github.com/apache/daffodil/pull/821#discussion_r1062916584
##########
daffodil-japi/src/test/java/org/apache/daffodil/example/TestJavaAPI.java:
##########
@@ -1213,4 +1215,81 @@ public void testJavaAPI26() throws IOException,
ClassNotFoundException, External
assertTrue(DaffodilXMLEntityResolver.getXMLEntityResolver() != null);
assertTrue(DaffodilXMLEntityResolver.getLSResourceResolver() != null);
}
+
+ @Test
+ public void testJavaAPINullXMLTextEscapeStyle() throws IOException,
ClassNotFoundException {
+ ByteArrayOutputStream xmlBos = new ByteArrayOutputStream();
+ try {
+ XMLTextInfosetOutputter outputter = new
XMLTextInfosetOutputter(xmlBos, true, null);
+ } catch (Exception e) {
+ String msg = e.getMessage().toLowerCase();
+ assertTrue(msg.contains("unrecognized"));
+ assertTrue(msg.contains("null"));
+ assertTrue(msg.contains("xmltextescapestyle"));
+ }
+ }
+
+ @Test
+ public void testJavaAPICDATA1() throws IOException, ClassNotFoundException
{
+ String expected = "<![CDATA[NO_WHITESPACE_AT_ALL]]>";
+ String data = "NO_WHITESPACE_AT_ALL$";
+ String schemaType = "string";
+ doXMLTextEscapeStyleTest(expected, data, schemaType);
+ }
+
+ @Test
+ public void testJavaAPICDATA2() throws IOException, ClassNotFoundException
{
+ String expected = "<![CDATA[ 'some' stuff here  and
]]]]><![CDATA[> even]]>";
+ String data = " 'some' stuff here  and ]]> even$";
+ String schemaType = "string";
+ doXMLTextEscapeStyleTest(expected, data, schemaType);
+ }
+
+ @Test
+ public void testJavaAPICDATA3() throws IOException, ClassNotFoundException
{
+ String expected = "6.892";
+ String data = "6.892";
+ String schemaType = "float";
+ doXMLTextEscapeStyleTest(expected, data, schemaType);
+ }
+
+ @Test
+ public void testJavaAPICDATA4() throws IOException, ClassNotFoundException
{
+ String expected = "<![CDATA[this contains a CRLF\nline ending]]>";
+ String data = "this contains a CRLF\r\nline ending$";
+ String schemaType = "string";
+ doXMLTextEscapeStyleTest(expected, data, schemaType);
+ }
+
+ @Test
+ public void testJavaAPICDATA5() throws IOException, ClassNotFoundException
{
+ String expected = "<![CDATA[abcd>]]>";
+ String data = "abcd>$";
Review Comment:
The $ character is used as a delimiter in the test schema. It keeps me from
having a unique schema for each test since the schemas would only vary from
each other by the dfdl:length value.
--
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]