You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2026/04/07 13:02:36 UTC
(jena) 04/05: Allow reset of TestMakers
This is an automated email from the ASF dual-hosted git repository.
andy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git
commit 73e01c13f78f69011ec3a1ef8d9438b4e686f551
Author: Andy Seaborne <an...@apache.org>
AuthorDate: Sun Apr 5 20:12:06 2026 +0100
Allow reset of TestMakers
---
.../apache/jena/arq/junit/manifest/TestMakers.java | 34 ++++++++++++++++------
.../jena/arq/junit/riot/RiotTestsConfig.java | 2 +-
2 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/TestMakers.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/TestMakers.java
index 025c492860..3d4ee22ec4 100644
--- a/jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/TestMakers.java
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/TestMakers.java
@@ -21,7 +21,6 @@
package org.apache.jena.arq.junit.manifest;
-import java.util.ArrayList;
import java.util.List;
import org.apache.jena.arq.junit.SurpressedTest;
@@ -40,17 +39,13 @@ public class TestMakers {
public static TestMaker testMakerSPARQL = SparqlTests::makeSPARQLTest;
public static TestMaker testMakerRIOT = RiotTests::makeRIOTTest;
- private final List<TestMaker> installed = new ArrayList<>();
private static TestMakers systemSetup = systemSetup();
// The test makers in the codebase for W3C tests.
// Add more with "install"
private static TestMakers systemSetup() {
- TestMakers maker = new TestMakers();
- maker.add(testMakerSPARQL);
- maker.add(testMakerRIOT);
- maker.add(SemanticsTests::makeSemanticsTest);
- return maker;
+ List<TestMaker> testMakers = List.of(testMakerSPARQL, testMakerRIOT, SemanticsTests::makeSemanticsTest);
+ return new TestMakers(testMakers);
}
/**
@@ -60,19 +55,40 @@ public class TestMakers {
systemSetup.add(testMaker);
}
+ public static void reset() {
+ systemSetup = systemSetup();
+ }
+
+ /**
+ * Directly set the system setup.
+ */
+ public static void set(List<TestMaker> testMakers) {
+ systemSetup = new TestMakers(List.copyOf(testMakers));;
+ }
+
/** Return the system-wide instance of {@link TestMakers}. */
public static TestMakers system() {
return systemSetup;
}
+ private final List<TestMaker> installed;
+
+ private TestMakers(List<TestMaker> testMakers) {
+ installed = testMakers;
+ }
+
public void add(TestMaker testMaker) {
installed.add(testMaker);
}
+ public void clear() {
+ installed.clear();
+ }
+
/**
* Return a function that takes a {@link ManifestEntry} and provides a test maker.
- * The function iterates through the installed {@link TestMaker TestMakers}
- * until it finds one that
+ * The test maker iterates through the installed {@link TestMaker TestMakers}
+ * for each entry until it finds one that return non-null.
* If no test maker is found, return a {@link SurpressedTest}.
*/
public TestMaker testMaker() {
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/RiotTestsConfig.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/RiotTestsConfig.java
index 81909ad1a8..54211d781b 100644
--- a/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/RiotTestsConfig.java
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/RiotTestsConfig.java
@@ -33,7 +33,7 @@ public class RiotTestsConfig {
* The allowWarning rules are maintained here and used in RiotEvalTests and RiotSyntaxTests.
*/
- /*package*/ static boolean allowWarnings(ManifestEntry testEntry) {
+ /*package*/ static boolean allowWarnings(ManifestEntry testEntry) {
if ( RiotTests.equalsType(testEntry.getTestType(), VocabLangRDF.TestEvalRDFXML) ) {
// RDF/XML
// Various warnings in eval tests.