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

veithen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ws-axiom.git


The following commit(s) were added to refs/heads/master by this push:
     new a41c7c290 Migrate XMLReaderTestSuiteBuilder to MatrixTestNode framework
a41c7c290 is described below

commit a41c7c2904f815822f38033ba9a6776e9049983f
Author: Andreas Veithen-Knowles <[email protected]>
AuthorDate: Sun Mar 8 13:19:59 2026 +0000

    Migrate XMLReaderTestSuiteBuilder to MatrixTestNode framework
    
    - Replace XMLReaderTestSuiteBuilder with XMLReaderTestSuite factory using
      InjectorNode and ParameterFanOutNode
    - Convert TestGetSetFeature from MatrixTestCase to TestCase with @Inject 
fields
    - Convert ValidationTest and AbstractXMLReaderTest consumers from JUnit 3
      static suite() to JUnit 5 @TestFactory
    - Add junit-jupiter and guice test dependencies to axiom-api
    - Delete old XMLReaderTestSuiteBuilder class
---
 axiom-api/pom.xml                                  | 10 +++++
 .../axiom/util/sax/AbstractXMLReaderTest.java      | 15 +++----
 .../apache/axiom/util/sax/TestGetSetFeature.java   | 19 +++++----
 .../org/apache/axiom/util/sax/ValidationTest.java  | 15 ++++---
 .../apache/axiom/util/sax/XMLReaderTestSuite.java  | 48 ++++++++++++++++++++++
 .../axiom/util/sax/XMLReaderTestSuiteBuilder.java  | 39 ------------------
 6 files changed, 85 insertions(+), 61 deletions(-)

diff --git a/axiom-api/pom.xml b/axiom-api/pom.xml
index 394da4830..175ca67d5 100644
--- a/axiom-api/pom.xml
+++ b/axiom-api/pom.xml
@@ -82,6 +82,16 @@
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.google.inject</groupId>
+            <artifactId>guice</artifactId>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.junit.vintage</groupId>
             <artifactId>junit-vintage-engine</artifactId>
diff --git 
a/axiom-api/src/test/java/org/apache/axiom/util/sax/AbstractXMLReaderTest.java 
b/axiom-api/src/test/java/org/apache/axiom/util/sax/AbstractXMLReaderTest.java
index 7f01bfba2..37a56b979 100644
--- 
a/axiom-api/src/test/java/org/apache/axiom/util/sax/AbstractXMLReaderTest.java
+++ 
b/axiom-api/src/test/java/org/apache/axiom/util/sax/AbstractXMLReaderTest.java
@@ -19,16 +19,17 @@
 package org.apache.axiom.util.sax;
 
 import java.io.IOException;
+import java.util.stream.Stream;
 
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.jupiter.api.DynamicNode;
+import org.junit.jupiter.api.TestFactory;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
-public class AbstractXMLReaderTest extends TestCase {
-    public static TestSuite suite() throws Exception {
-        return new XMLReaderTestSuiteBuilder(
+public class AbstractXMLReaderTest {
+    @TestFactory
+    public Stream<DynamicNode> tests() {
+        return XMLReaderTestSuite.create(
                         new AbstractXMLReader() {
                             @Override
                             public void parse(String systemId) throws 
IOException, SAXException {}
@@ -36,6 +37,6 @@ public class AbstractXMLReaderTest extends TestCase {
                             @Override
                             public void parse(InputSource input) throws 
IOException, SAXException {}
                         })
-                .build();
+                .toDynamicNodes();
     }
 }
diff --git 
a/axiom-api/src/test/java/org/apache/axiom/util/sax/TestGetSetFeature.java 
b/axiom-api/src/test/java/org/apache/axiom/util/sax/TestGetSetFeature.java
index 55645954a..d72ca1d12 100644
--- a/axiom-api/src/test/java/org/apache/axiom/util/sax/TestGetSetFeature.java
+++ b/axiom-api/src/test/java/org/apache/axiom/util/sax/TestGetSetFeature.java
@@ -18,18 +18,19 @@
  */
 package org.apache.axiom.util.sax;
 
-import org.apache.axiom.testutils.suite.MatrixTestCase;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+
+import junit.framework.TestCase;
+
 import org.xml.sax.XMLReader;
 
-public class TestGetSetFeature extends MatrixTestCase {
-    private final XMLReader xmlReader;
-    private final String feature;
+public class TestGetSetFeature extends TestCase {
+    @Inject private XMLReader xmlReader;
 
-    public TestGetSetFeature(XMLReader xmlReader, String feature) {
-        this.xmlReader = xmlReader;
-        this.feature = feature;
-        addTestParameter("feature", feature);
-    }
+    @Inject
+    @Named("feature")
+    private String feature;
 
     @Override
     protected void runTest() throws Throwable {
diff --git 
a/axiom-api/src/test/java/org/apache/axiom/util/sax/ValidationTest.java 
b/axiom-api/src/test/java/org/apache/axiom/util/sax/ValidationTest.java
index 880526c78..af1acd837 100644
--- a/axiom-api/src/test/java/org/apache/axiom/util/sax/ValidationTest.java
+++ b/axiom-api/src/test/java/org/apache/axiom/util/sax/ValidationTest.java
@@ -18,15 +18,18 @@
  */
 package org.apache.axiom.util.sax;
 
+import java.util.stream.Stream;
+
 import javax.xml.parsers.SAXParserFactory;
 
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.jupiter.api.DynamicNode;
+import org.junit.jupiter.api.TestFactory;
 
-public class ValidationTest extends TestCase {
-    public static TestSuite suite() throws Exception {
-        return new XMLReaderTestSuiteBuilder(
+public class ValidationTest {
+    @TestFactory
+    public Stream<DynamicNode> tests() throws Exception {
+        return XMLReaderTestSuite.create(
                         
SAXParserFactory.newInstance().newSAXParser().getXMLReader())
-                .build();
+                .toDynamicNodes();
     }
 }
diff --git 
a/axiom-api/src/test/java/org/apache/axiom/util/sax/XMLReaderTestSuite.java 
b/axiom-api/src/test/java/org/apache/axiom/util/sax/XMLReaderTestSuite.java
new file mode 100644
index 000000000..b4e3a8c9f
--- /dev/null
+++ b/axiom-api/src/test/java/org/apache/axiom/util/sax/XMLReaderTestSuite.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.util.sax;
+
+import org.apache.axiom.testutils.suite.InjectorNode;
+import org.apache.axiom.testutils.suite.MatrixTest;
+import org.apache.axiom.testutils.suite.ParameterFanOutNode;
+import org.xml.sax.XMLReader;
+
+import com.google.common.collect.ImmutableList;
+import com.google.inject.AbstractModule;
+
+public class XMLReaderTestSuite {
+    public static InjectorNode create(XMLReader xmlReader) {
+        return new InjectorNode(
+                new AbstractModule() {
+                    @Override
+                    protected void configure() {
+                        bind(XMLReader.class).toInstance(xmlReader);
+                    }
+                },
+                new ParameterFanOutNode<>(
+                        String.class,
+                        ImmutableList.of(
+                                "http://xml.org/sax/features/namespaces";,
+                                
"http://xml.org/sax/features/namespace-prefixes";,
+                                
"http://xml.org/sax/features/external-general-entities";),
+                        "feature",
+                        s -> s,
+                        new MatrixTest(TestGetSetFeature.class)));
+    }
+}
diff --git 
a/axiom-api/src/test/java/org/apache/axiom/util/sax/XMLReaderTestSuiteBuilder.java
 
b/axiom-api/src/test/java/org/apache/axiom/util/sax/XMLReaderTestSuiteBuilder.java
deleted file mode 100644
index 889573d37..000000000
--- 
a/axiom-api/src/test/java/org/apache/axiom/util/sax/XMLReaderTestSuiteBuilder.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.axiom.util.sax;
-
-import org.apache.axiom.testutils.suite.MatrixTestSuiteBuilder;
-import org.xml.sax.XMLReader;
-
-public class XMLReaderTestSuiteBuilder extends MatrixTestSuiteBuilder {
-    private final XMLReader xmlReader;
-
-    public XMLReaderTestSuiteBuilder(XMLReader xmlReader) {
-        this.xmlReader = xmlReader;
-    }
-
-    @Override
-    protected void addTests() {
-        addTest(new TestGetSetFeature(xmlReader, 
"http://xml.org/sax/features/namespaces";));
-        addTest(new TestGetSetFeature(xmlReader, 
"http://xml.org/sax/features/namespace-prefixes";));
-        addTest(
-                new TestGetSetFeature(
-                        xmlReader, 
"http://xml.org/sax/features/external-general-entities";));
-    }
-}

Reply via email to