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 080e35cf0 Generalize toDynamicNodes to accept BiPredicate instead of
MatrixTestFilters
080e35cf0 is described below
commit 080e35cf004b2e885c123ec1e4a236a0c1551c88
Author: Andreas Veithen-Knowles <[email protected]>
AuthorDate: Sun Mar 1 08:07:53 2026 +0000
Generalize toDynamicNodes to accept BiPredicate instead of MatrixTestFilters
Replace the MatrixTestFilters parameter in toDynamicNodes with
BiPredicate<Class<?>, Dictionary<String, String>> so callers are not
forced to depend on MatrixTestFilters. Add a no-arg toDynamicNodes()
overload for the common case where no exclusions are needed.
Update SAAJRITest and documentation accordingly.
---
testing/matrix-testsuite/README.md | 11 ++++++-----
testing/matrix-testsuite/migration.md | 2 +-
.../apache/axiom/testutils/suite/AbstractFanOutNode.java | 3 ++-
.../java/org/apache/axiom/testutils/suite/MatrixTest.java | 3 ++-
.../org/apache/axiom/testutils/suite/MatrixTestNode.java | 3 ++-
.../org/apache/axiom/testutils/suite/MatrixTestSuite.java | 13 ++++++++++---
.../src/test/java/org/apache/axiom/ts/saaj/SAAJRITest.java | 4 +---
7 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/testing/matrix-testsuite/README.md
b/testing/matrix-testsuite/README.md
index c8d6599d6..e0f6a8717 100644
--- a/testing/matrix-testsuite/README.md
+++ b/testing/matrix-testsuite/README.md
@@ -57,10 +57,11 @@ Root Injector
### Filtering
Parameters accumulate from the root down through the tree. At each leaf, the
-accumulated parameter dictionary is checked against `MatrixTestFilters` — an
-immutable set of LDAP-style filter expressions optionally scoped to a test
class.
+accumulated parameter dictionary is checked against a
+`BiPredicate<Class<?>, Dictionary<String, String>>` exclusion predicate.
Excluded tests produce an empty `Stream<DynamicNode>` and do not appear in the
-test tree.
+test tree. `MatrixTestFilters` is a convenient implementation of this predicate
+that supports LDAP-style filter expressions optionally scoped to a test class.
## Classes
@@ -72,7 +73,7 @@ Abstract base class for all nodes in the test tree. Defines a
single method:
abstract Stream<DynamicNode> toDynamicNodes(
Injector parentInjector,
Dictionary<String, String> inheritedParameters,
- MatrixTestFilters excludes);
+ BiPredicate<Class<?>, Dictionary<String, String>> excludes);
```
### `AbstractFanOutNode<T>`
@@ -107,7 +108,7 @@ Root of a test suite. Owns the Guice root injector (created
from caller-supplied
modules) and a list of top-level `MatrixTestNode` children. Provides:
```java
-public Stream<DynamicNode> toDynamicNodes(MatrixTestFilters excludes)
+public Stream<DynamicNode> toDynamicNodes(BiPredicate<Class<?>,
Dictionary<String, String>> excludes)
```
### `MatrixTestFilters`
diff --git a/testing/matrix-testsuite/migration.md
b/testing/matrix-testsuite/migration.md
index a04d10c96..ab85a4ffb 100644
--- a/testing/matrix-testsuite/migration.md
+++ b/testing/matrix-testsuite/migration.md
@@ -228,7 +228,7 @@ public class SAAJRITest {
@TestFactory
public Stream<DynamicNode> saajTests() {
return SAAJTestSuite.create(new SAAJMetaFactoryImpl())
- .toDynamicNodes(MatrixTestFilters.builder().build());
+ .toDynamicNodes();
}
}
```
diff --git
a/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/AbstractFanOutNode.java
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/AbstractFanOutNode.java
index 2843a8c0c..8a37226bc 100644
---
a/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/AbstractFanOutNode.java
+++
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/AbstractFanOutNode.java
@@ -24,6 +24,7 @@ import java.util.Enumeration;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
+import java.util.function.BiPredicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -74,7 +75,7 @@ public abstract class AbstractFanOutNode<T> extends
MatrixTestNode {
Stream<DynamicNode> toDynamicNodes(
Injector parentInjector,
Dictionary<String, String> inheritedParameters,
- MatrixTestFilters excludes) {
+ BiPredicate<Class<?>, Dictionary<String, String>> excludes) {
return values.stream()
.map(
value -> {
diff --git
a/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTest.java
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTest.java
index 0356c1a78..7fca9c115 100644
---
a/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTest.java
+++
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTest.java
@@ -19,6 +19,7 @@
package org.apache.axiom.testutils.suite;
import java.util.Dictionary;
+import java.util.function.BiPredicate;
import java.util.stream.Stream;
import org.junit.jupiter.api.DynamicNode;
@@ -50,7 +51,7 @@ public class MatrixTest extends MatrixTestNode {
Stream<DynamicNode> toDynamicNodes(
Injector injector,
Dictionary<String, String> inheritedParameters,
- MatrixTestFilters excludes) {
+ BiPredicate<Class<?>, Dictionary<String, String>> excludes) {
if (excludes.test(testClass, inheritedParameters)) {
return Stream.empty();
}
diff --git
a/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTestNode.java
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTestNode.java
index b306f66ec..1e7349d24 100644
---
a/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTestNode.java
+++
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTestNode.java
@@ -19,6 +19,7 @@
package org.apache.axiom.testutils.suite;
import java.util.Dictionary;
+import java.util.function.BiPredicate;
import java.util.stream.Stream;
import org.junit.jupiter.api.DynamicNode;
@@ -37,5 +38,5 @@ public abstract class MatrixTestNode {
abstract Stream<DynamicNode> toDynamicNodes(
Injector parentInjector,
Dictionary<String, String> inheritedParameters,
- MatrixTestFilters excludes);
+ BiPredicate<Class<?>, Dictionary<String, String>> excludes);
}
diff --git
a/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTestSuite.java
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTestSuite.java
index 4eb896001..9fe89155f 100644
---
a/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTestSuite.java
+++
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTestSuite.java
@@ -19,8 +19,10 @@
package org.apache.axiom.testutils.suite;
import java.util.ArrayList;
+import java.util.Dictionary;
import java.util.Hashtable;
import java.util.List;
+import java.util.function.BiPredicate;
import java.util.stream.Stream;
import org.junit.jupiter.api.DynamicNode;
@@ -31,8 +33,8 @@ import com.google.inject.Module;
/**
* Root of a test suite. Owns the Guice root injector and the tree of {@link
MatrixTestNode}
- * instances. Provides a {@link #toDynamicNodes(MatrixTestFilters)} method
that converts the tree to
- * JUnit 5 dynamic nodes, applying the supplied exclusion filters.
+ * instances. Provides a {@link #toDynamicNodes(BiPredicate)} method that
converts the tree to JUnit
+ * 5 dynamic nodes, applying the supplied exclusion predicate.
*
* <p>Exclusion filters are <em>not</em> owned by the suite itself because
they are specific to each
* consumer (implementation under test), whereas the suite structure and
bindings are defined by the
@@ -50,8 +52,13 @@ public class MatrixTestSuite {
children.add(child);
}
- public Stream<DynamicNode> toDynamicNodes(MatrixTestFilters excludes) {
+ public Stream<DynamicNode> toDynamicNodes(
+ BiPredicate<Class<?>, Dictionary<String, String>> excludes) {
return children.stream()
.flatMap(child -> child.toDynamicNodes(rootInjector, new
Hashtable<>(), excludes));
}
+
+ public Stream<DynamicNode> toDynamicNodes() {
+ return toDynamicNodes((testClass, parameters) -> false);
+ }
}
diff --git
a/testing/saaj-testsuite/src/test/java/org/apache/axiom/ts/saaj/SAAJRITest.java
b/testing/saaj-testsuite/src/test/java/org/apache/axiom/ts/saaj/SAAJRITest.java
index c4b9b61a1..4a758e363 100644
---
a/testing/saaj-testsuite/src/test/java/org/apache/axiom/ts/saaj/SAAJRITest.java
+++
b/testing/saaj-testsuite/src/test/java/org/apache/axiom/ts/saaj/SAAJRITest.java
@@ -20,7 +20,6 @@ package org.apache.axiom.ts.saaj;
import java.util.stream.Stream;
-import org.apache.axiom.testutils.suite.MatrixTestFilters;
import org.junit.jupiter.api.DynamicNode;
import org.junit.jupiter.api.TestFactory;
@@ -29,7 +28,6 @@ import com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl;
public class SAAJRITest {
@TestFactory
public Stream<DynamicNode> saajTests() {
- return SAAJTestSuite.create(new SAAJMetaFactoryImpl())
- .toDynamicNodes(MatrixTestFilters.builder().build());
+ return SAAJTestSuite.create(new
SAAJMetaFactoryImpl()).toDynamicNodes();
}
}