stevedlawrence commented on code in PR #1122:
URL: https://github.com/apache/daffodil/pull/1122#discussion_r1409315190
##########
daffodil-japi/src/test/java/org/apache/daffodil/example/TestJavaAPI.java:
##########
@@ -1346,4 +1346,38 @@ public void testJavaAPIBlob1() throws IOException,
ClassNotFoundException, Inval
Files.delete(blobDir);
}
}
+
+ /**
+ * Verify that ProcessorFactory.withDistinguishedRootNode selects the
right node
+ */
+ @Test
+ public void testJavaAPIWithDistinguishedRootNode() throws IOException,
ClassNotFoundException {
+ org.apache.daffodil.japi.Compiler c = Daffodil.compiler();
+
+ // e3 is defined first in mySchema3.dfdl.xsd, so if
withDistinguishedRootNode is ignored,
+ // this should give a different result
+ java.io.File schemaFile = getResource("/test/japi/mySchema3.dfdl.xsd");
+ ProcessorFactory pf = c.compileFile(schemaFile);
+ pf = pf.withDistinguishedRootNode("e4", null);
+ DataProcessor dp = pf.onPath("/");
Review Comment:
I mentioned this in my big comment above, but isError it's not mandatory.
The `pf.onPath` function calls `isError`. The only problem is if `isError` is
true then `onPath` will thrown an assertion exception. But that's not a big
deal in a test because a thrown exception will still cause the test to fail. It
maybe isn't as elegant as an assertion, e.g. `assertFalse(pf.isError)`, but
ultimately tests things just the same.
--
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]