Copilot commented on code in PR #393:
URL: 
https://github.com/apache/maven-shared-utils/pull/393#discussion_r3644887209


##########
src/test/java/org/apache/maven/shared/utils/xml/Xpp3DomBuilderTest.java:
##########
@@ -79,6 +79,14 @@ public void trimming() {
         assertEquals("  preserve space  ", 
dom.getChild("element6").getValue());
     }
 
+    @Test
+    public void buildDoesNotModifySaxDriverProperty() {
+        String key = "org.xml.sax.driver";
+        String original = System.getProperty(key);
+        Xpp3DomBuilder.build(new StringReader("<root/>"));
+        assertEquals(original, System.getProperty(key));
+    }

Review Comment:
   This test observes a global JVM system property but does not restore it if 
`Xpp3DomBuilder.build(...)` throws or if the assertion fails. That can leak 
mutated global state into subsequent tests and cause cascading failures, which 
is inconsistent with how other tests in this repo manage system properties 
(e.g., OsTest uses `@AfterEach` to restore). Wrap the call/assertion in a 
try/finally and restore (set/clear) the property in the finally block.



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