This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
new 23c65d0589 Partial revert of previous changes: we need to keep JUnit 4
`org.junit.Assume` until the JUnit 4 runner is remplaced by the JUnit 5 runner.
23c65d0589 is described below
commit 23c65d05897a9a4b4a5fd52938077464c18fa609
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Mon Feb 12 14:09:15 2024 +0100
Partial revert of previous changes: we need to keep JUnit 4
`org.junit.Assume` until the JUnit 4 runner is remplaced by the JUnit 5 runner.
---
.../test/org/apache/sis/io/wkt/ComparisonWithEPSG.java | 2 +-
.../test/org/apache/sis/storage/StorageConnectorTest.java | 3 +--
.../test/org/apache/sis/converter/PathConverterTest.java | 2 +-
.../org.apache.sis.util/test/org/apache/sis/measure/RangeTest.java | 5 ++---
.../org.apache.sis.util/test/org/apache/sis/test/Assumptions.java | 7 +++++++
.../test/org/apache/sis/test/OptionalTestData.java | 5 +++--
6 files changed, 15 insertions(+), 9 deletions(-)
diff --git
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/io/wkt/ComparisonWithEPSG.java
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/io/wkt/ComparisonWithEPSG.java
index 9a8cfb3949..af4b8b9b63 100644
---
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/io/wkt/ComparisonWithEPSG.java
+++
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/io/wkt/ComparisonWithEPSG.java
@@ -28,7 +28,7 @@ import org.apache.sis.referencing.factory.sql.EPSGFactory;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
-import static org.junit.jupiter.api.Assumptions.assumeTrue;
+import static org.junit.Assume.assumeTrue;
import org.apache.sis.test.TestCase;
import static org.apache.sis.test.Assertions.assertEqualsIgnoreMetadata;
diff --git
a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/StorageConnectorTest.java
b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/StorageConnectorTest.java
index c4b6671c00..cd2f594604 100644
---
a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/StorageConnectorTest.java
+++
b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/StorageConnectorTest.java
@@ -37,7 +37,6 @@ import org.apache.sis.storage.internal.InputStreamAdapter;
// Test dependencies
import org.junit.Test;
-import static org.junit.jupiter.api.Assumptions.assumeTrue;
import static org.junit.jupiter.api.Assertions.*;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.DependsOn;
@@ -255,7 +254,7 @@ public final class StorageConnectorTest extends TestCase {
* (which is the case when the resource is an ordinary file, not an
entry inside a JAR file),
* otherwise the call to connector.getStorageAs(…) throws a
DataStoreException.
*/
- assumeTrue(in.markSupported(), "Cannot use a JAR file entry for this
test.");
+ assertTrue(in.markSupported(), "Cannot use a JAR file entry for this
test.");
assertSame(in, connector.getStorageAs(InputStream.class));
final byte[] actual = new byte[sample.length];
assertEquals(actual.length, in.read(actual), "Should read all
requested bytes.");
diff --git
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/converter/PathConverterTest.java
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/converter/PathConverterTest.java
index b86645379a..c21a50a5c2 100644
---
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/converter/PathConverterTest.java
+++
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/converter/PathConverterTest.java
@@ -28,7 +28,7 @@ import org.apache.sis.util.UnconvertibleObjectException;
// Test dependencies
import org.junit.Test;
-import static org.junit.jupiter.api.Assumptions.assumeTrue;
+import static org.junit.Assume.assumeTrue;
import static org.junit.jupiter.api.Assertions.*;
import org.apache.sis.test.PlatformDependent;
import org.apache.sis.test.DependsOn;
diff --git
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/RangeTest.java
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/RangeTest.java
index 4a921fd1ab..a288ec1f58 100644
---
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/RangeTest.java
+++
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/RangeTest.java
@@ -21,7 +21,6 @@ import java.time.Instant;
// Test dependencies
import org.junit.Test;
-import static org.junit.jupiter.api.Assumptions.assumeTrue;
import static org.junit.jupiter.api.Assertions.*;
import org.apache.sis.test.TestCase;
import static org.apache.sis.test.Assertions.assertSerializedEquals;
@@ -90,7 +89,7 @@ public final class RangeTest extends TestCase {
@Test(expected = IllegalArgumentException.class)
@SuppressWarnings({"unchecked", "rawtypes",
"ResultOfObjectAllocationIgnored"})
public void testConstructorErrors00() {
- assumeTrue(Range.class.desiredAssertionStatus());
+ assertTrue(Range.class.desiredAssertionStatus());
new Range(Double.class, "error", true, "blast", true);
}
@@ -105,7 +104,7 @@ public final class RangeTest extends TestCase {
@Test(expected = IllegalArgumentException.class)
@SuppressWarnings({"unchecked", "rawtypes",
"ResultOfObjectAllocationIgnored"})
public void testConstructorErrors01() {
- assumeTrue(Range.class.desiredAssertionStatus());
+ assertTrue(Range.class.desiredAssertionStatus());
new Range(String.class, 123.233, true, 8740.09, true);
}
diff --git
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/test/Assumptions.java
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/test/Assumptions.java
index 5ee7b45779..31e81059f6 100644
--- a/endorsed/src/org.apache.sis.util/test/org/apache/sis/test/Assumptions.java
+++ b/endorsed/src/org.apache.sis.util/test/org/apache/sis/test/Assumptions.java
@@ -51,6 +51,8 @@ public final class Assumptions {
* @return the path to the given file.
*/
public static URI assumeDataExists(final DataDirectory type, final String
file) {
+ try { // Temporary hack during the transition from JUnit 4 to
JUnit 5.
+
assumeTrue(System.getenv(DataDirectory.ENV) != null, "$SIS_DATA
environment variable not set.");
Path path = type.getDirectory();
assumeTrue(path != null, () -> "$SIS_DATA/" + type + " directory not
found.");
@@ -58,5 +60,10 @@ public final class Assumptions {
assumeTrue(Files.exists(path), "Specified file or directory not
found.");
assumeTrue(Files.isReadable(path), "Specified directory not
readable.");
return path.toUri();
+
+ } catch (org.opentest4j.TestAbortedException e) {
+ org.junit.Assume.assumeTrue(e.getMessage(), false);
+ return null;
+ }
}
}
diff --git
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/test/OptionalTestData.java
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/test/OptionalTestData.java
index 32b3952b80..54d50f3710 100644
---
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/test/OptionalTestData.java
+++
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/test/OptionalTestData.java
@@ -26,7 +26,7 @@ import java.nio.file.Path;
import org.apache.sis.system.DataDirectory;
// Test dependencies
-import static org.junit.jupiter.api.Assumptions.assumeTrue;
+import static org.junit.Assume.assumeTrue;
/**
@@ -145,7 +145,8 @@ public enum OptionalTestData {
*/
private InputStream open() throws IOException {
final Optional<Path> path = path();
- assumeTrue(path.isPresent(), () -> "File “$SIS_DATA/Tests/" + filename
+ "” has not been found.");
+ assumeTrue("File “$SIS_DATA/Tests/" + filename + "” has not been
found.", path.isPresent());
+// assumeTrue(path.isPresent(), () -> "File “$SIS_DATA/Tests/" + filename
+ "” has not been found.");
return Files.newInputStream(path.get());
}