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

commit 9f73d3edf5fcdc4d110d3f357c48f8d22772b3f1
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Tue Jun 24 17:36:09 2025 +0200

    Rely less on `CommonCRS` and more on `HardCodedCRS` in JUnit tests,
    for making them less sensitive to whether an EPSG database is present.
---
 .../test/org/apache/sis/geometry/EnvelopeReducerTest.java          | 7 +++----
 .../org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java    | 5 ++---
 .../operation/DefaultCoordinateOperationFactoryTest.java           | 4 ++--
 .../sis/referencing/operation/projection/ObliqueMercatorTest.java  | 4 ++--
 .../referencing/operation/transform/MolodenskyTransformTest.java   | 4 ++--
 5 files changed, 11 insertions(+), 13 deletions(-)

diff --git 
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/EnvelopeReducerTest.java
 
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/EnvelopeReducerTest.java
index d26f945531..e86b29af49 100644
--- 
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/EnvelopeReducerTest.java
+++ 
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/EnvelopeReducerTest.java
@@ -17,11 +17,11 @@
 package org.apache.sis.geometry;
 
 import org.opengis.referencing.operation.TransformException;
-import org.apache.sis.referencing.CommonCRS;
 
 // Test dependencies
 import org.junit.jupiter.api.Test;
 import org.apache.sis.test.TestCase;
+import org.apache.sis.referencing.crs.HardCodedCRS;
 import static org.apache.sis.referencing.Assertions.assertEnvelopeEquals;
 
 
@@ -40,14 +40,13 @@ public final class EnvelopeReducerTest extends TestCase {
      * Creates an envelope for the given coordinate values.
      */
     private static GeneralEnvelope createFromExtremums(boolean latlon, double 
xmin, double ymin, double xmax, double ymax) {
-        final CommonCRS crs = CommonCRS.WGS84;
         final GeneralEnvelope env;
         if (latlon) {
-            env = new GeneralEnvelope(crs.geographic());
+            env = new GeneralEnvelope(HardCodedCRS.WGS84_LATITUDE_FIRST);
             env.setRange(1, xmin, xmax);
             env.setRange(0, ymin, ymax);
         } else {
-            env = new GeneralEnvelope(crs.normalizedGeographic());
+            env = new GeneralEnvelope(HardCodedCRS.WGS84);
             env.setRange(0, xmin, xmax);
             env.setRange(1, ymin, ymax);
         }
diff --git 
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
 
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
index 8376c09f8c..c5a4988027 100644
--- 
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
+++ 
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
@@ -26,7 +26,6 @@ import org.opengis.referencing.cs.CartesianCS;
 import org.opengis.referencing.operation.Conversion;
 import org.opengis.parameter.ParameterValueGroup;
 import org.apache.sis.metadata.iso.citation.Citations;
-import org.apache.sis.referencing.CommonCRS;
 import org.apache.sis.referencing.factory.InvalidGeodeticParameterException;
 import org.apache.sis.referencing.privy.GeodeticObjectBuilder;
 import org.apache.sis.util.ComparisonMode;
@@ -524,8 +523,8 @@ public final class DefaultProjectedCRSTest extends 
TestCase.WithLogs {
      */
     @Test
     public void testEquals() throws FactoryException {
-        final ProjectedCRS standard   = create(CommonCRS.WGS84.geographic());
-        final ProjectedCRS normalized = 
create(CommonCRS.WGS84.normalizedGeographic());
+        final ProjectedCRS standard   = 
create(HardCodedCRS.WGS84_LATITUDE_FIRST);
+        final ProjectedCRS normalized = create(HardCodedCRS.WGS84);
         final var c = assertInstanceOf(LenientComparable.class, standard);
         assertFalse(c.equals(normalized, ComparisonMode.STRICT));
         assertFalse(c.equals(normalized, ComparisonMode.BY_CONTRACT));
diff --git 
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactoryTest.java
 
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactoryTest.java
index 8422c98203..c7ce93f6f1 100644
--- 
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactoryTest.java
+++ 
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactoryTest.java
@@ -28,7 +28,6 @@ import 
org.opengis.referencing.operation.CoordinateOperationAuthorityFactory;
 import org.opengis.referencing.operation.SingleOperation;
 import org.opengis.referencing.operation.TransformException;
 import org.apache.sis.referencing.CRS;
-import org.apache.sis.referencing.CommonCRS;
 import org.apache.sis.referencing.privy.Formulas;
 import org.apache.sis.referencing.internal.PositionalAccuracyConstant;
 import org.apache.sis.util.privy.Constants;
@@ -42,6 +41,7 @@ import org.junit.jupiter.api.TestInstance;
 import static org.junit.jupiter.api.Assertions.*;
 import org.junit.jupiter.api.parallel.Execution;
 import org.junit.jupiter.api.parallel.ExecutionMode;
+import org.apache.sis.referencing.crs.HardCodedCRS;
 import org.apache.sis.referencing.operation.transform.MathTransformTestCase;
 import static org.apache.sis.test.Assertions.assertMessageContains;
 import static 
org.apache.sis.referencing.Assertions.assertEpsgNameAndIdentifierEqual;
@@ -328,7 +328,7 @@ public final class DefaultCoordinateOperationFactoryTest 
extends MathTransformTe
      */
     @Test
     public void testPositionVectorTransformation() throws ParseException, 
FactoryException, TransformException {
-        final CoordinateReferenceSystem sourceCRS = 
CommonCRS.WGS84.geographic();
+        final CoordinateReferenceSystem sourceCRS = 
HardCodedCRS.WGS84_LATITUDE_FIRST;
         final CoordinateReferenceSystem targetCRS = 
parse(CoordinateOperationFinderTest.AGD66());
         final CoordinateOperation operation = 
factory.createOperation(sourceCRS, targetCRS, null);
         transform  = operation.getMathTransform();
diff --git 
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/projection/ObliqueMercatorTest.java
 
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/projection/ObliqueMercatorTest.java
index 8438d9af2a..bbae27f48e 100644
--- 
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/projection/ObliqueMercatorTest.java
+++ 
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/projection/ObliqueMercatorTest.java
@@ -20,12 +20,12 @@ import static java.lang.StrictMath.*;
 import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.referencing.datum.Ellipsoid;
 import org.opengis.referencing.operation.TransformException;
-import org.apache.sis.referencing.CommonCRS;
 import org.apache.sis.referencing.operation.provider.ObliqueMercatorCenter;
 import org.apache.sis.parameter.Parameters;
 
 // Test dependencies
 import org.junit.jupiter.api.Test;
+import org.apache.sis.referencing.datum.HardCodedDatum;
 
 // Specific to the geoapi-3.1 and geoapi-4.0 branches:
 import org.opengis.util.FactoryException;
@@ -57,7 +57,7 @@ public final class ObliqueMercatorTest extends 
MapProjectionTestCase {
     private static ObliqueMercator create(final double cx, final double cy, 
final double azimuth) {
         final ObliqueMercatorCenter method = new ObliqueMercatorCenter();
         final ParameterValueGroup values = 
method.getParameters().createValue();
-        final Ellipsoid ellipsoid = CommonCRS.WGS84.ellipsoid();
+        final Ellipsoid ellipsoid = HardCodedDatum.WGS84.getEllipsoid();
         values.parameter("semi_major")         
.setValue(ellipsoid.getSemiMajorAxis());
         values.parameter("semi_minor")         
.setValue(ellipsoid.getSemiMinorAxis());
         values.parameter("azimuth")            .setValue(azimuth);
diff --git 
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java
 
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java
index 47182d5a47..699e340af0 100644
--- 
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java
+++ 
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java
@@ -144,7 +144,7 @@ public final class MolodenskyTransformTest extends 
MathTransformTestCase {
      * @throws FactoryException if an error occurred while creating a 
transform step.
      */
     private void create(final boolean abridged) throws FactoryException {
-        final Ellipsoid source = CommonCRS.WGS84.ellipsoid();
+        final Ellipsoid source = HardCodedDatum.WGS84.getEllipsoid();
         final Ellipsoid target = CommonCRS.ED50.ellipsoid();
         transform = MolodenskyTransform.createGeodeticTransformation(
                 DefaultMathTransformFactory.provider(),
@@ -383,7 +383,7 @@ public final class MolodenskyTransformTest extends 
MathTransformTestCase {
      */
     @Test
     public void testIdentity() throws FactoryException {
-        final Ellipsoid source = CommonCRS.WGS84.ellipsoid();
+        final Ellipsoid source = HardCodedDatum.WGS84.getEllipsoid();
         transform = MolodenskyTransform.createGeodeticTransformation(
                 DefaultMathTransformFactory.provider(), source, false, source, 
false, 0, 0, 0, false);
         assertInstanceOf(LinearTransform.class, transform);

Reply via email to