garydgregory commented on code in PR #766:
URL: https://github.com/apache/commons-text/pull/766#discussion_r3944032082
##########
src/test/java/org/apache/commons/text/lookup/XmlStringLookupTest.java:
##########
@@ -50,6 +51,19 @@ class XmlStringLookupTest {
private static final String DOC_RELATIVE = DOC_DIR + "document.xml";
private static final String DOC_ROOT = "/document.xml";
+ /**
+ * Asserts the secure contract for an external reference: the parser
either rejects the document or parses it
+ * with the reference resolved to empty content, but the external content
never appears in the result.
+ */
+ static void assertBlocksOrDoesNotLeak(final Supplier<String> lookup, final
String external) {
+ try {
+ final String result = lookup.get();
+ assertFalse(result != null && result.contains(external), () ->
"external content leaked: " + result);
+ } catch (final IllegalArgumentException e) {
Review Comment:
@ppkarwasz Is this expected? If so, use `assertThrows()`.
--
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]