This is an automated email from the ASF dual-hosted git repository.

ppkarwasz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/commons-secure-xml.git


The following commit(s) were added to refs/heads/main by this push:
     new 754b0a1  Disable Mockito-based tests in the native image
754b0a1 is described below

commit 754b0a1eab7deacca8c63e86ea013199a4a598f5
Author: Piotr P. Karwasz <[email protected]>
AuthorDate: Tue Sep 1 09:42:23 2026 +0200

    Disable Mockito-based tests in the native image
    
    Mockito generates mock classes and plugin proxies at run time, which a
    closed-world native image cannot do, so the two tests stubbing JAXP
    factories for their error paths failed the GraalVM job. Annotate them
    with @DisabledInNativeImage, as the XSLTC-pinning transform test
    already is; the rest of both classes stays enabled natively.
    
    Assisted-By: Claude Fable 5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_01CLnTBsvmYtxzNTWVGNyz33
---
 .../org/apache/commons/xml/secure/FallbackIgnoreURIResolverTest.java  | 4 ++++
 .../org/apache/commons/xml/secure/SecureSAXParserFactoryTest.java     | 4 ++++
 2 files changed, 8 insertions(+)

diff --git 
a/src/test/java/org/apache/commons/xml/secure/FallbackIgnoreURIResolverTest.java
 
b/src/test/java/org/apache/commons/xml/secure/FallbackIgnoreURIResolverTest.java
index dbba632..b992eef 100644
--- 
a/src/test/java/org/apache/commons/xml/secure/FallbackIgnoreURIResolverTest.java
+++ 
b/src/test/java/org/apache/commons/xml/secure/FallbackIgnoreURIResolverTest.java
@@ -32,10 +32,14 @@
 import javax.xml.transform.dom.DOMSource;
 
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledInNativeImage;
 
 class FallbackIgnoreURIResolverTest {
 
     @Test
+    // Mockito generates the mock class and its plugin proxies at run time — 
impossible in a closed-world native image,
+    // so the stubbed factory this error path needs cannot be built there.
+    @DisabledInNativeImage
     void newEmptyDocumentThrowsExceptionInInitializerError() throws Exception {
         final DocumentBuilderFactory factory = 
mock(DocumentBuilderFactory.class);
         final ParserConfigurationException failure = new 
ParserConfigurationException("test");
diff --git 
a/src/test/java/org/apache/commons/xml/secure/SecureSAXParserFactoryTest.java 
b/src/test/java/org/apache/commons/xml/secure/SecureSAXParserFactoryTest.java
index c17f61d..43d0b05 100644
--- 
a/src/test/java/org/apache/commons/xml/secure/SecureSAXParserFactoryTest.java
+++ 
b/src/test/java/org/apache/commons/xml/secure/SecureSAXParserFactoryTest.java
@@ -43,6 +43,7 @@
 import org.junit.jupiter.api.Assumptions;
 import org.junit.jupiter.api.Tag;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledInNativeImage;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
@@ -186,6 +187,9 @@ void newXmlReaderFollowsParserSelection() throws Exception {
     }
 
     @Test
+    // Mockito generates the mock classes and its plugin proxies at run time — 
impossible in a closed-world native image,
+    // so the stubbed factories these error paths need cannot be built there.
+    @DisabledInNativeImage
     void newXmlReaderWrapsDeclaredExceptions() throws Exception {
         Assumptions.assumeFalse(AttackTestSupport.IS_ANDROID, "Skipped on 
Android: parser selection is pinned to the platform implementation");
         final String previous = 
setFactoryIdProperty(MockSAXParserFactory.class.getName());

Reply via email to