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 b63ff4731 Rename @TestFactory methods to tests() by convention
b63ff4731 is described below
commit b63ff4731a392d594fc425b29d55af4fbae8786c
Author: Andreas Veithen-Knowles <[email protected]>
AuthorDate: Sun Mar 8 11:02:34 2026 +0000
Rename @TestFactory methods to tests() by convention
Update all @TestFactory methods to use the conventional name 'tests' and
call this out explicitly in the migration guide.
---
systests/cross-om-tests/src/test/java/DOOM2LLOMTest.java | 2 +-
systests/cross-om-tests/src/test/java/LLOM2DOOMTest.java | 2 +-
testing/matrix-testsuite/migration.md | 15 ++++++++-------
.../test/java/org/apache/axiom/ts/saaj/SAAJRITest.java | 2 +-
4 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/systests/cross-om-tests/src/test/java/DOOM2LLOMTest.java
b/systests/cross-om-tests/src/test/java/DOOM2LLOMTest.java
index 56912c213..8aeddfd48 100644
--- a/systests/cross-om-tests/src/test/java/DOOM2LLOMTest.java
+++ b/systests/cross-om-tests/src/test/java/DOOM2LLOMTest.java
@@ -25,7 +25,7 @@ import org.junit.jupiter.api.TestFactory;
public class DOOM2LLOMTest {
@TestFactory
- public Stream<DynamicNode> crossOMTests() {
+ public Stream<DynamicNode> tests() {
return CrossOMTestSuite.create(
OMAbstractFactory.getMetaFactory(),
OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM))
diff --git a/systests/cross-om-tests/src/test/java/LLOM2DOOMTest.java
b/systests/cross-om-tests/src/test/java/LLOM2DOOMTest.java
index ecca089d8..990e55571 100644
--- a/systests/cross-om-tests/src/test/java/LLOM2DOOMTest.java
+++ b/systests/cross-om-tests/src/test/java/LLOM2DOOMTest.java
@@ -25,7 +25,7 @@ import org.junit.jupiter.api.TestFactory;
public class LLOM2DOOMTest {
@TestFactory
- public Stream<DynamicNode> crossOMTests() {
+ public Stream<DynamicNode> tests() {
return CrossOMTestSuite.create(
OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM),
OMAbstractFactory.getMetaFactory())
diff --git a/testing/matrix-testsuite/migration.md
b/testing/matrix-testsuite/migration.md
index cea757332..d256a05dc 100644
--- a/testing/matrix-testsuite/migration.md
+++ b/testing/matrix-testsuite/migration.md
@@ -231,7 +231,7 @@ Key differences:
The old consumer class uses JUnit 3's `static suite()` method.
**Replace it** with a JUnit 5 class that has a `@TestFactory` method returning
-`Stream<DynamicNode>`.
+`Stream<DynamicNode>`. By convention, the method should be called `tests`.
**Before:**
@@ -248,7 +248,7 @@ public class SAAJRITest extends TestCase {
```java
public class SAAJRITest {
@TestFactory
- public Stream<DynamicNode> saajTests() {
+ public Stream<DynamicNode> tests() {
return SAAJTestSuite.create(new SAAJMetaFactoryImpl())
.toDynamicNodes();
}
@@ -307,8 +307,9 @@ migration is simpler because there is no separate base
class or suite factory:
1. Change the class to extend `TestCase` directly and declare dimension values
as `@Inject` fields instead of constructor parameters.
2. Remove the constructor and all `addTestParameter()` calls.
-3. Replace the `static suite()` method with a `@TestFactory` method that builds
- the fan-out tree directly and calls `toDynamicNodes()` on the root node.
+3. Replace the `static suite()` method with a `@TestFactory` method called
+ `tests` that builds the fan-out tree directly and calls `toDynamicNodes()`
+ on the root node.
No `InjectorNode` is needed unless you have additional bindings beyond the
dimension values.
@@ -361,7 +362,7 @@ public class StAXPivotTransformerTest extends TestCase {
}
@TestFactory
- public static Stream<DynamicNode> suite() {
+ public static Stream<DynamicNode> tests() {
return new ParameterFanOutNode<>(
XSLTImplementation.class,
Multiton.getInstances(XSLTImplementation.class),
@@ -402,7 +403,7 @@ example by filtering the list of instances passed to the
fan-out node.
### Self-contained test suites
- [ ] Test class: extends `TestCase`, uses `@Inject` fields, no constructor
-- [ ] `static suite()` replaced with `@TestFactory` method building fan-out
- tree and calling `toDynamicNodes()`
+- [ ] `static suite()` replaced with `@TestFactory` method `tests()` building
+ fan-out tree and calling `toDynamicNodes()`
- [ ] `pom.xml`: `junit-jupiter`, `guice`, and (if needed) `multiton` added
- [ ] Tests pass: `mvn clean test -pl <module> -am`
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 4a758e363..5d829b47f 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
@@ -27,7 +27,7 @@ import com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl;
public class SAAJRITest {
@TestFactory
- public Stream<DynamicNode> saajTests() {
+ public Stream<DynamicNode> tests() {
return SAAJTestSuite.create(new
SAAJMetaFactoryImpl()).toDynamicNodes();
}
}