mbeckerle commented on code in PR #821:
URL: https://github.com/apache/daffodil/pull/821#discussion_r1055549939


##########
daffodil-japi/src/test/java/org/apache/daffodil/example/TestJavaAPI.java:
##########
@@ -931,6 +931,15 @@ public void testJavaAPI20() throws IOException, 
ClassNotFoundException {
         assertEquals("42", unparseBos.toString());
     }
 
+    @Test
+    public void testJavaAPINullXmlOutputStyle() {
+        ByteArrayOutputStream xmlBos = new ByteArrayOutputStream();
+        try {
+            XMLTextInfosetOutputter outputter = new 
XMLTextInfosetOutputter(xmlBos, true, null);
+        } catch (Exception e) {
+                 assertTrue(e.getMessage().contains("Null is not a valid value 
for parameter xmlOutputStyle"));
+        }
+    }

Review Comment:
   I saw this wasn't fixed yet, so added a comment on the new line of code 
where this problem still exists.
   So resolving this here. 



##########
daffodil-japi/src/test/java/org/apache/daffodil/example/TestJavaAPI.java:
##########
@@ -1213,4 +1215,70 @@ public void testJavaAPI26() throws IOException, 
ClassNotFoundException, External
         assertTrue(DaffodilXMLEntityResolver.getXMLEntityResolver() != null);
         assertTrue(DaffodilXMLEntityResolver.getLSResourceResolver() != null);
     }
+
+    @Test
+    public void testJavaAPINullxmlOutputStyle() throws IOException, 
ClassNotFoundException {
+        ByteArrayOutputStream xmlBos = new ByteArrayOutputStream();
+        try {
+            XMLTextInfosetOutputter outputter = new 
XMLTextInfosetOutputter(xmlBos, true, null);
+        } catch (Exception e) {
+            assertTrue(e.getMessage().contains("Unrecognized value: null for 
parameter: xmlTextEscapeStyle"));

Review Comment:
   Suggest 
   ```
   val msg = e.getMessage().toLowerCase
   assertTrue(msg.contains("unrecognized")
   assertTrue(msg.contains("null")
   assertTrue(msg.contains("xmlTextEscapeStyle")
   ```
   That will be less fragile if the message changes slighly 



-- 
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]

Reply via email to