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 aef287b12 Refactor InjectorNode to take ImmutableList<Module> with 
single-module convenience constructor
aef287b12 is described below

commit aef287b129104f638054b9f981d74da32630de8f
Author: Andreas Veithen-Knowles <[email protected]>
AuthorDate: Mon Mar 2 22:27:04 2026 +0000

    Refactor InjectorNode to take ImmutableList<Module> with single-module 
convenience constructor
---
 testing/matrix-testsuite/README.md                    |  3 ++-
 testing/matrix-testsuite/migration.md                 |  3 ++-
 .../apache/axiom/testutils/suite/InjectorNode.java    | 19 +++++++++++++++++--
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/testing/matrix-testsuite/README.md 
b/testing/matrix-testsuite/README.md
index d681991b4..7673c2b25 100644
--- a/testing/matrix-testsuite/README.md
+++ b/testing/matrix-testsuite/README.md
@@ -106,7 +106,8 @@ exclusion filters.
 
 A node that creates a child Guice injector from the supplied modules and 
threads
 it through its children. Can be used at any level of the test tree to introduce
-additional bindings. Provides:
+additional bindings. Accepts either an `ImmutableList<Module>` (primary
+constructor) or a single `Module` (convenience constructor). Provides:
 
 ```java
 public Stream<DynamicNode> toDynamicNodes(BiPredicate<Class<?>, Map<String, 
String>> excludes)
diff --git a/testing/matrix-testsuite/migration.md 
b/testing/matrix-testsuite/migration.md
index aba07b44c..ed28287f6 100644
--- a/testing/matrix-testsuite/migration.md
+++ b/testing/matrix-testsuite/migration.md
@@ -136,7 +136,8 @@ The old `*TestSuiteBuilder` class extends 
`MatrixTestSuiteBuilder` and overrides
 `InjectorNode`. The factory method:
 
 1. Creates an `InjectorNode` with a Guice module that binds
-   implementation-level objects.
+   implementation-level objects. Pass a single `Module` directly (convenience
+   constructor) or an `ImmutableList<Module>` when you need multiple modules.
 2. Creates fan-out nodes for each dimension.
 3. Adds `MatrixTest` leaf nodes for each test case class.
 
diff --git 
a/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/InjectorNode.java
 
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/InjectorNode.java
index cfd19aa38..eb1d82c6a 100644
--- 
a/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/InjectorNode.java
+++ 
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/InjectorNode.java
@@ -26,6 +26,7 @@ import java.util.stream.Stream;
 
 import org.junit.jupiter.api.DynamicNode;
 
+import com.google.common.collect.ImmutableList;
 import com.google.inject.Injector;
 import com.google.inject.Module;
 
@@ -38,13 +39,27 @@ import com.google.inject.Module;
  * test suite author.
  */
 public class InjectorNode extends MatrixTestNode {
-    private final Module[] modules;
+    private final ImmutableList<Module> modules;
     private final List<MatrixTestNode> children = new ArrayList<>();
 
-    public InjectorNode(Module... modules) {
+    /**
+     * Creates a new node with the given list of modules.
+     *
+     * @param modules the Guice modules to install when creating the child 
injector
+     */
+    public InjectorNode(ImmutableList<Module> modules) {
         this.modules = modules;
     }
 
+    /**
+     * Convenience constructor for the common case of a single module.
+     *
+     * @param module the Guice module to install when creating the child 
injector
+     */
+    public InjectorNode(Module module) {
+        this(ImmutableList.of(module));
+    }
+
     public void addChild(MatrixTestNode child) {
         children.add(child);
     }

Reply via email to