You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2021/07/31 13:39:43 UTC
[sis] 04/05: Formatting,
resolve compiler warning and use more specific test methods.
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 fdb3f59ba5a0d2a10588dc55c54072eb38d73ddc
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Sat Jul 31 14:11:02 2021 +0200
Formatting, resolve compiler warning and use more specific test methods.
---
.../src/test/java/org/apache/sis/cql/FilterReadingTest.java | 9 +++++----
.../test/java/org/apache/sis/filter/SpatialTestCase.java | 13 +++++++------
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/core/sis-cql/src/test/java/org/apache/sis/cql/FilterReadingTest.java b/core/sis-cql/src/test/java/org/apache/sis/cql/FilterReadingTest.java
index 1a88493..29d7fd8 100644
--- a/core/sis-cql/src/test/java/org/apache/sis/cql/FilterReadingTest.java
+++ b/core/sis-cql/src/test/java/org/apache/sis/cql/FilterReadingTest.java
@@ -26,14 +26,13 @@ import java.text.ParseException;
import javax.measure.Quantity;
import javax.measure.quantity.Length;
-import org.apache.sis.geometry.AbstractEnvelope;
-import org.apache.sis.geometry.GeneralEnvelope;
import org.opengis.geometry.Envelope;
import org.opengis.util.CodeList;
-import org.opengis.feature.Feature;
import org.apache.sis.measure.Units;
import org.apache.sis.measure.Quantities;
+import org.apache.sis.geometry.AbstractEnvelope;
+import org.apache.sis.geometry.GeneralEnvelope;
import org.apache.sis.geometry.Envelope2D;
import org.apache.sis.referencing.CommonCRS;
import org.apache.sis.internal.util.UnmodifiableArrayList;
@@ -48,9 +47,11 @@ import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.LinearRing;
-// Branch dependant imports
+// Branch-dependent imports
+import org.opengis.feature.Feature;
import org.opengis.filter.*;
+
/**
* Test reading CQL filters.
*
diff --git a/core/sis-feature/src/test/java/org/apache/sis/filter/SpatialTestCase.java b/core/sis-feature/src/test/java/org/apache/sis/filter/SpatialTestCase.java
index 91e3400..478d06f 100644
--- a/core/sis-feature/src/test/java/org/apache/sis/filter/SpatialTestCase.java
+++ b/core/sis-feature/src/test/java/org/apache/sis/filter/SpatialTestCase.java
@@ -32,6 +32,7 @@ import org.apache.sis.referencing.operation.HardCodedConversions;
import org.junit.Test;
import static org.junit.Assert.*;
+import static org.opengis.test.Assert.assertInstanceOf;
import static org.apache.sis.test.Assert.assertSerializedEquals;
// Branch-dependent imports
@@ -49,6 +50,7 @@ import org.opengis.filter.BinarySpatialOperator;
*
* @author Johann Sorel (Geomatys)
* @author Martin Desruisseaux (Geomatys)
+ * @author Alexis Manin (Geomatys)
* @version 1.1
*
* @param <G> root class of geometry implementation.
@@ -122,17 +124,16 @@ public abstract strictfp class SpatialTestCase<G> extends TestCase {
}
/**
- * Ensure that expressions provided as arguments for bbox filter are not hidden. We mean that if they're wrapped for
- * internal purpose, the wrappers should not be publicly exposed.
+ * Ensures that expressions provided as arguments for BBOX filter are not hidden.
+ * If they are wrapped for internal purpose, the wrappers should not be publicly exposed.
*/
@Test
public void bbox_preserve_expression_type() {
final BinarySpatialOperator<Feature> bbox = factory.bbox(literal(Polygon.RIGHT), new Envelope2D(null, 0, 0, 1, 1));
final Expression<? super Feature, ?> arg2 = bbox.getOperand2();
- assertTrue("The two ways to acquire the second argument return different values", arg2 == bbox.getExpressions().get(1));
- assertTrue(
- "Second argument value should be an envelope",
- arg2 instanceof Literal && ((Literal<Feature, ?>) arg2).getValue() instanceof Envelope);
+ assertSame("The two ways to acquire the second argument return different values.", arg2, bbox.getExpressions().get(1));
+ assertInstanceOf("Second argument value should be an envelope.", Envelope.class,
+ ((Literal<? super Feature, ?>) arg2).getValue());
}
/**