This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/sis.git
commit b87b99f314ec81477c650fc0c7602a2ea10f619c Merge: 55d09a63e0 f4bb5471ef Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Wed Feb 21 11:37:01 2024 +0100 Merge branch 'geoapi-3.1': last JUnit5 tuning. https://issues.apache.org/jira/browse/SIS-457 endorsed/build.gradle.kts | 5 + .../sis/coverage/grid/j2d/TilePlaceholder.java | 4 +- .../main/org/apache/sis/image/TileCache.java | 3 +- .../apache/sis/feature/AbstractFeatureTest.java | 14 +- .../apache/sis/feature/FeatureMemoryBenchmark.java | 6 +- .../org/apache/sis/feature/FeatureTestCase.java | 2 +- .../feature/builder/FeatureTypeBuilderTest.java | 4 +- .../apache/sis/feature/test/FeatureComparator.java | 35 ++- .../test/org/apache/sis/filter/PeriodLiteral.java | 3 +- .../apache/sis/filter/sqlmm/RegistryTestCase.java | 52 ++-- .../apache/sis/image/StatisticsCalculatorTest.java | 18 +- .../org.apache.sis.metadata/main/module-info.java | 1 + .../sis/metadata/PropertyConsistencyCheck.java | 9 +- .../test/org/apache/sis/metadata/TreeNodeTest.java | 4 +- .../org/apache/sis/metadata/TreeTableViewTest.java | 4 +- .../apache/sis/metadata/iso/AllMetadataTest.java | 10 - .../iso/identification/DefaultResolutionTest.java | 25 +- .../maintenance/DefaultScopeDescriptionTest.java | 24 +- .../iso/spatial/DefaultGeorectifiedTest.java | 24 +- .../sis/metadata/sql/MetadataFallbackVerifier.java | 2 +- .../sis/metadata/sql/MetadataSourceTest.java | 2 + .../sis/metadata/sql/MetadataWriterTest.java | 2 + .../org/apache/sis/metadata/sql/TestDatabase.java | 43 +++- .../sis/util/iso/DefaultNameFactoryTest.java | 28 +- .../org/apache/sis/util/iso/DefaultRecordTest.java | 43 ++-- .../apache/sis/util/iso/DefaultRecordTypeTest.java | 30 +-- .../apache/sis/util/iso/NameMarshallingTest.java | 33 +-- .../sis/util/iso/SerializableRecordSchema.java | 20 +- .../apache/sis/xml/bind/gco/MultiplicityTest.java | 16 +- .../apache/sis/xml/bind/gml/TimePeriodTest.java | 45 +--- .../apache/sis/xml/bind/lan/LanguageCodeTest.java | 29 +-- .../sis/xml/test/AnnotationConsistencyCheck.java | 11 +- .../apache/sis/xml/test/DocumentComparator.java | 48 ++-- .../test/org/apache/sis/xml/test/TestCase.java | 38 +++ .../sis/openoffice/ReferencingFunctionsTest.java | 23 +- .../org/apache/sis/openoffice/TransformerTest.java | 23 +- .../coverage/MultiResolutionCoverageLoader.java | 3 +- .../apache/sis/referencing/AuthorityFactories.java | 2 + .../main/org/apache/sis/referencing/CommonCRS.java | 281 +++++++++++---------- .../referencing/factory/sql/EPSGDataAccess.java | 22 +- .../apache/sis/geometry/AbstractEnvelopeTest.java | 6 +- .../apache/sis/geometry/GeneralEnvelopeTest.java | 3 +- .../org/apache/sis/io/wkt/ComparisonWithEPSG.java | 31 ++- .../org/apache/sis/io/wkt/WKTDictionaryTest.java | 4 +- .../apache/sis/parameter/ParameterFormatTest.java | 28 +- .../sis/parameter/ParameterMarshallingTest.java | 33 +-- .../org/apache/sis/referencing/Assertions.java | 26 +- .../sis/referencing/AuthorityFactoriesTest.java | 30 +-- .../test/org/apache/sis/referencing/CRSTest.java | 46 ++-- .../sis/referencing/EPSGFactoryFallbackTest.java | 5 + .../sis/referencing/GeodeticObjectVerifier.java | 4 +- .../referencing/crs/DefaultProjectedCRSTest.java | 47 ++-- .../org/apache/sis/referencing/cs/CodesTest.java | 2 +- .../factory/ConcurrentAuthorityFactoryTest.java | 46 +++- .../factory/MultiAuthoritiesFactoryTest.java | 32 +-- .../sis/referencing/factory/TestFactorySource.java | 91 +++---- .../referencing/factory/sql/EPSGFactoryTest.java | 150 +++++------ .../referencing/factory/sql/EPSGInstallerTest.java | 35 +-- .../operation/CoordinateOperationFinderTest.java | 91 +++---- .../operation/CoordinateOperationRegistryTest.java | 48 ++-- .../DefaultCoordinateOperationFactoryTest.java | 38 +-- .../operation/SingleOperationMarshallingTest.java | 24 +- .../builder/LocalizationGridBuilderTest.java | 3 + .../projection/ConformalProjectionTest.java | 5 +- .../projection/MapProjectionTestCase.java | 4 +- .../projection/MercatorMethodComparison.java | 4 + .../projection/NormalizedProjectionTest.java | 3 + .../{Benchmark.java => ProjectionBenchmark.java} | 14 +- .../projection/ProjectionResultComparator.java | 3 +- .../operation/provider/GeographicOffsetsTest.java | 5 +- .../operation/provider/MapProjectionTest.java | 4 +- .../referencing/operation/provider/NTv2Test.java | 6 +- .../operation/transform/CartesianToPolarTest.java | 3 + .../transform/CartesianToSphericalTest.java | 3 + .../transform/CoordinateSystemTransformTest.java | 45 ++-- .../transform/EllipsoidToCentricTransformTest.java | 28 +- .../transform/LinearInterpolator1DTest.java | 3 + .../operation/transform/MathTransformTestCase.java | 43 +++- .../operation/transform/MathTransformWrapper.java | 4 +- .../operation/transform/PolarToCartesianTest.java | 3 + .../transform/ProjectiveTransformTest.java | 3 + .../transform/SphericalToCartesianTest.java | 3 + .../transform/TransformResultComparator.java | 6 +- .../report/CoordinateOperationMethods.java | 16 +- .../referencing/util/j2d/ShapeUtilitiesExt.java | 9 +- .../sis/test/integration/ConsistencyTest.java | 6 +- .../integration/CoordinateReferenceSystemTest.java | 7 +- .../apache/sis/test/integration/MetadataTest.java | 23 +- .../sis/test/integration/MetadataVerticalTest.java | 22 +- .../CC_GeneralOperationParameterTest.java | 32 +-- .../sis/storage/geotiff/SelfConsistencyTest.java | 49 ++-- .../sis/storage/netcdf/SelfConsistencyTest.java | 50 ++-- .../apache/sis/storage/netcdf/base/GridTest.java | 4 + .../apache/sis/storage/netcdf/base/TestCase.java | 57 +++-- .../apache/sis/storage/sql/TestOnAllDatabases.java | 6 + .../sql/feature/SelectionClauseWriterTest.java | 2 +- .../sis/storage/sql/postgis/PostgresTest.java | 2 + .../org/apache/sis/storage/gpx/StoreProvider.java | 13 + .../org/apache/sis/storage/gpx/ReaderTest.java | 25 +- .../org/apache/sis/storage/gpx/UpdaterTest.java | 23 +- .../org/apache/sis/storage/gpx/WriterTest.java | 21 +- .../org/apache/sis/storage/CoverageSubset.java | 7 +- .../sis/storage/esri/BILConsistencyTest.java | 45 ++-- .../sis/storage/esri/BIPConsistencyTest.java | 45 ++-- .../sis/storage/esri/BSQConsistencyTest.java | 45 ++-- .../org/apache/sis/storage/folder/StoreTest.java | 4 +- .../sis/storage/image/SelfConsistencyTest.java | 45 ++-- .../sis/storage/image/WorldFileStoreTest.java | 93 +++---- .../sis/storage/test/CoverageReadConsistency.java | 89 +++++-- .../apache/sis/storage/test/SubsampledImage.java | 13 +- .../src/org.apache.sis.util/main/module-info.java | 1 + .../main/org/apache/sis/pending/jdk/JDK16.java | 18 +- .../main/org/apache/sis/system/Configuration.java | 3 +- .../main/org/apache/sis/util/collection/Cache.java | 3 +- .../test/org/apache/sis/io/LineAppenderTest.java | 4 +- .../org/apache/sis/io/TabulationExpansionTest.java | 4 +- .../test/org/apache/sis/io/WordWrapTest.java | 4 +- .../org/apache/sis/measure/SystemUnitTest.java | 7 +- .../sis/test/{Performance.java => Benchmark.java} | 21 +- .../apache/sis/test/FailureDetailsReporter.java | 42 +-- .../org/apache/sis/test/LogRecordCollector.java | 122 ++++++--- .../test/org/apache/sis/test/LoggingWatcher.java | 197 +++++++++++++-- .../test/org/apache/sis/test/TestCase.java | 19 +- .../test/org/apache/sis/test/TestCaseWithLogs.java | 76 ++++++ .../org/apache/sis/test/TestConfiguration.java | 11 - .../test/org/apache/sis/test/TestStep.java | 12 +- .../test/org/apache/sis/test/TestUtilities.java | 91 +------ .../org/apache/sis/util/collection/CacheTest.java | 11 +- .../apache/sis/util/collection/RangeSetTest.java | 6 +- .../apache/sis/util/collection/TestCaseWithGC.java | 114 +++++++++ .../sis/util/collection/TreeTableFormatTest.java | 3 + .../sis/util/collection/WeakHashSetTest.java | 15 +- .../sis/util/collection/WeakValueHashMapTest.java | 7 +- .../sis/util/logging/PerformanceLevelTest.java | 3 + incubator/build.gradle.kts | 5 + .../storage/coveragejson/binding/BindingTest.java | 24 +- .../sis/storage/shapefile/ShapefileStoreTest.java | 33 +-- optional/build.gradle.kts | 5 + 138 files changed, 1911 insertions(+), 1709 deletions(-) diff --cc endorsed/src/org.apache.sis.feature/test/org/apache/sis/feature/AbstractFeatureTest.java index 3a00544abf,637b6a10d9..c1caf4d461 --- a/endorsed/src/org.apache.sis.feature/test/org/apache/sis/feature/AbstractFeatureTest.java +++ b/endorsed/src/org.apache.sis.feature/test/org/apache/sis/feature/AbstractFeatureTest.java @@@ -61,10 -67,10 +61,10 @@@ public final class AbstractFeatureTest */ CustomFeature(final DefaultFeatureType type) { super(type); - for (final AbstractIdentifiedType pt : type.getProperties(true)) { - if (pt instanceof DefaultAttributeType<?>) { - Object value = ((DefaultAttributeType<?>) pt).getDefaultValue(); - if (isMultiValued(pt)) { - for (final PropertyType property : type.getProperties(true)) { - if (property instanceof AttributeType<?> attribute) { ++ for (final AbstractIdentifiedType property : type.getProperties(true)) { ++ if (property instanceof DefaultAttributeType<?> attribute) { + Object value = attribute.getDefaultValue(); + if (isMultiValued(property)) { value = new ArrayList<>(PropertyView.singletonOrEmpty(value)); } if (value != null) { @@@ -116,8 -122,8 +116,8 @@@ } if (value != null) { final Class<?> base; - if (property instanceof DefaultAttributeType<?>) { - base = ((DefaultAttributeType<?>) property).getValueClass(); - if (property instanceof AttributeType<?> attribute) { ++ if (property instanceof DefaultAttributeType<?> attribute) { + base = attribute.getValueClass(); } else { base = FeatureType.class; } diff --cc endorsed/src/org.apache.sis.feature/test/org/apache/sis/feature/builder/FeatureTypeBuilderTest.java index 627bde51a0,001d297b87..667bb4915f --- a/endorsed/src/org.apache.sis.feature/test/org/apache/sis/feature/builder/FeatureTypeBuilderTest.java +++ b/endorsed/src/org.apache.sis.feature/test/org/apache/sis/feature/builder/FeatureTypeBuilderTest.java @@@ -375,10 -376,10 +375,10 @@@ public final class FeatureTypeBuilderTe /** * Verifies that the given property is an attribute with the given name and value class. */ - private static void assertPropertyEquals(final String name, final Class<?> valueClass, IdentifiedType property) { + private static void assertPropertyEquals(final String name, final Class<?> valueClass, AbstractIdentifiedType property) { assertEquals(name, property.getName().toString()); - if (property instanceof AbstractOperation) { - property = ((AbstractOperation) property).getResult(); - if (property instanceof Operation op) { ++ if (property instanceof AbstractOperation op) { + property = op.getResult(); } assertEquals(valueClass, attributeType(property).getValueClass()); } diff --cc endorsed/src/org.apache.sis.feature/test/org/apache/sis/feature/test/FeatureComparator.java index 44219cfe49,31a2c18b25..1d954820dc --- a/endorsed/src/org.apache.sis.feature/test/org/apache/sis/feature/test/FeatureComparator.java +++ b/endorsed/src/org.apache.sis.feature/test/org/apache/sis/feature/test/FeatureComparator.java @@@ -28,7 -28,7 +28,6 @@@ import java.util.Iterator import java.util.Objects; import java.util.stream.Collectors; import org.opengis.util.GenericName; --import org.apache.sis.util.Deprecable; import org.apache.sis.util.internal.CollectionsExt; // Test dependencies @@@ -175,16 -176,16 +174,16 @@@ public class FeatureComparator * @param actual the actual type. * @throws AssertionError if the actual type is not equal to the expected type. */ - private void compareType(final IdentifiedType expected, final IdentifiedType actual) { + private void compareType(final AbstractIdentifiedType expected, final AbstractIdentifiedType actual) { boolean recognized = false; - if (expected instanceof DefaultFeatureType) { - if (expected instanceof FeatureType type) { - var c = assertInstanceOf(FeatureType.class, actual, this::path); ++ if (expected instanceof DefaultFeatureType type) { + var c = assertInstanceOf(DefaultFeatureType.class, actual, this::path); - compareFeatureType((DefaultFeatureType) expected, c); + compareFeatureType(type, c); recognized = true; } - if (expected instanceof AbstractIdentifiedType) { - if (expected instanceof PropertyType type) { - var c = assertInstanceOf(PropertyType.class, actual, this::path); - comparePropertyType(type, c); ++ /* Condition in "geoapi-3.1" branch removed in this branch. */ { + var c = assertInstanceOf(AbstractIdentifiedType.class, actual, this::path); - comparePropertyType((AbstractIdentifiedType) expected, c); ++ comparePropertyType(expected, c); recognized = true; } if (!recognized) { @@@ -255,8 -256,8 +254,8 @@@ while (expectedIter.hasNext()) { final Object expectedElement = expectedIter.next(); final Object actualElement = actualIter.next(); - if (expectedElement instanceof AbstractFeature) { - compareFeature((AbstractFeature) expectedElement, (AbstractFeature) actualElement); - if (expectedElement instanceof Feature instance) { - compareFeature(instance, (Feature) actualElement); ++ if (expectedElement instanceof AbstractFeature instance) { ++ compareFeature(instance, (AbstractFeature) actualElement); } else { assertEquals(expectedElement, actualElement); } @@@ -272,18 -273,18 +271,18 @@@ * @param actual the actual property. * @throws AssertionError if the actual property is not equal to the expected property. */ - private void comparePropertyType(final PropertyType expected, final PropertyType actual) { - if (expected instanceof AttributeType<?> type) { - var c = assertInstanceOf(AttributeType.class, actual, this::path); + private void comparePropertyType(final AbstractIdentifiedType expected, final AbstractIdentifiedType actual) { - if (expected instanceof DefaultAttributeType) { ++ if (expected instanceof DefaultAttributeType<?> type) { + var c = assertInstanceOf(DefaultAttributeType.class, actual, this::path); - compareAttribute((DefaultAttributeType) expected, c); + compareAttribute(type, c); } - if (expected instanceof DefaultAssociationRole) { - if (expected instanceof FeatureAssociationRole role) { - var c = assertInstanceOf(FeatureAssociationRole.class, actual, this::path); ++ if (expected instanceof DefaultAssociationRole role) { + var c = assertInstanceOf(DefaultAssociationRole.class, actual, this::path); - compareFeatureAssociationRole((DefaultAssociationRole) expected, c); + compareFeatureAssociationRole(role, c); } - if (expected instanceof AbstractOperation) { - if (expected instanceof Operation op) { - var c = assertInstanceOf(Operation.class, actual, this::path); ++ if (expected instanceof AbstractOperation op) { + var c = assertInstanceOf(AbstractOperation.class, actual, this::path); - compareOperation((AbstractOperation) expected, c); + compareOperation(op, c); } } @@@ -379,10 -380,8 +378,8 @@@ if (!ignoreDescription) { assertEquals(expected.getDescription(), actual.getDescription(), () -> path() + "Description differ."); } - if (expected instanceof Deprecable && actual instanceof Deprecable) { - assertEquals(((Deprecable) expected).isDeprecated(), - ((Deprecable) actual).isDeprecated(), - () -> path() + "Deprecated state differ."); - if (expected instanceof Deprecable de && actual instanceof Deprecable da) { - assertEquals(de.isDeprecated(), da.isDeprecated(), () -> path() + "Deprecated state differ."); ++ /* Condition in "geoapi-3.1" branch removed in this branch. */ { ++ assertEquals(expected.isDeprecated(), actual.isDeprecated(), () -> path() + "Deprecated state differ."); } } diff --cc endorsed/src/org.apache.sis.feature/test/org/apache/sis/filter/sqlmm/RegistryTestCase.java index 0b99af2ed3,22bfa033ee..368d68f31f --- a/endorsed/src/org.apache.sis.feature/test/org/apache/sis/filter/sqlmm/RegistryTestCase.java +++ b/endorsed/src/org.apache.sis.feature/test/org/apache/sis/filter/sqlmm/RegistryTestCase.java @@@ -34,18 -34,17 +34,15 @@@ import org.apache.sis.math.Vector // Test dependencies import org.junit.jupiter.api.Test; - import org.junit.jupiter.api.AfterEach; import static org.junit.jupiter.api.Assertions.*; import static org.apache.sis.test.Assertions.assertMessageContains; - import org.junit.jupiter.api.extension.RegisterExtension; - import org.apache.sis.test.LoggingWatcher; - import org.apache.sis.test.TestCase; import org.apache.sis.referencing.crs.HardCodedCRS; + import org.apache.sis.test.TestCaseWithLogs; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.feature.Feature; -import org.opengis.filter.Literal; -import org.opengis.filter.Expression; -import org.opengis.filter.FilterFactory; -import org.opengis.filter.capability.AvailableFunction; +// Specific to the main branch: +import org.apache.sis.feature.AbstractFeature; +import org.apache.sis.filter.Expression; +import org.apache.sis.pending.geoapi.filter.Literal; /** diff --cc endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/iso/AllMetadataTest.java index 3e43d879e2,db175cea26..b977e2aac7 --- a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/iso/AllMetadataTest.java +++ b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/iso/AllMetadataTest.java @@@ -24,11 -23,10 +23,9 @@@ import org.apache.sis.metadata.Property // Test dependencies import org.junit.jupiter.api.Test; - import org.junit.jupiter.api.extension.RegisterExtension; - import org.apache.sis.test.LoggingWatcher; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.annotation.Stereotype; -import org.opengis.util.ControlledVocabulary; +// Specific to the main branch: +import org.opengis.util.CodeList; /** diff --cc endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/sql/MetadataWriterTest.java index a9678f2be3,e165493946..d05dda578d --- a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/sql/MetadataWriterTest.java +++ b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/sql/MetadataWriterTest.java @@@ -81,7 -85,7 +82,8 @@@ public final class MetadataWriterTest e * @throws Exception if an error occurred while writing or reading the database. */ @Test + @ResourceLock(TestDatabase.POSTGRESQL) + @org.junit.jupiter.api.Disabled("Requires GeoAPI 3.1.") public void testPostgreSQL() throws Exception { try (final TestDatabase db = TestDatabase.createOnPostgreSQL("MetadataWriter", true)) { source = new MetadataWriter(MetadataStandard.ISO_19115, db.source, "MetadataWriter", null); diff --cc endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/test/AnnotationConsistencyCheck.java index 0b594ea212,df26ea124c..f9528537ab --- a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/test/AnnotationConsistencyCheck.java +++ b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/test/AnnotationConsistencyCheck.java @@@ -43,8 -44,13 +44,8 @@@ import org.apache.sis.xml.bind.Context import org.junit.jupiter.api.Test; import org.opentest4j.AssertionFailedError; import org.apache.sis.test.TestUtilities; - import org.apache.sis.test.TestCase; + import org.apache.sis.test.TestCaseWithLogs; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.annotation.Classifier; -import org.opengis.annotation.Stereotype; -import org.opengis.util.ControlledVocabulary; - /** * Verifies consistency between {@link UML}, {@link XmlElement} and other annotations. @@@ -755,8 -754,13 +759,9 @@@ public abstract class AnnotationConsist */ final XmlType xmlType = impl.getAnnotation(XmlType.class); assertNotNull(xmlType, "Missing @XmlType annotation."); - String expected = getExpectedXmlTypeName(stereotype, uml); - if (expected == null) { - expected = DEFAULT; - } - assertEquals(expected, xmlType.name(), "Wrong @XmlType.name()."); + // More tests on development branch (removed on trunk because test depends on GeoAPI 3.1) } + loggings.assertNoUnexpectedLog(); } /** diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java index 5732c492b1,abcd65befc..eea7d36618 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java @@@ -2612,9 -2613,10 +2619,10 @@@ next: while (r.next() case 1: valueDomain = MeasurementRange.create(Double.NEGATIVE_INFINITY, false, Double.POSITIVE_INFINITY, false, CollectionsExt.first(units)); break; } - final Map<String, Object> properties = + @SuppressWarnings("LocalVariableHidesMemberVariable") + final Map<String,Object> properties = createProperties("Coordinate_Operation Parameter", name, epsg, isReversible, deprecated); - properties.put(Identifier.DESCRIPTION_KEY, description); + properties.put(ImmutableIdentifier.DESCRIPTION_KEY, description); final ParameterDescriptor<?> descriptor = new DefaultParameterDescriptor<>(properties, 1, 1, type, valueDomain, null, null); returnValue = ensureSingleton(descriptor, returnValue, code); diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java index 6f4255bb49,b5c2f5b5a2..4b2a7e8a4d --- 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 @@@ -37,19 -37,16 +37,16 @@@ import org.apache.sis.measure.Units // Test dependencies import org.junit.jupiter.api.Test; - import org.junit.jupiter.api.AfterEach; import static org.junit.jupiter.api.Assertions.*; - import org.junit.jupiter.api.extension.RegisterExtension; import org.opengis.test.Validators; - import org.apache.sis.test.LoggingWatcher; - import static org.apache.sis.test.Assertions.assertMessageContains; import org.apache.sis.xml.test.TestCase; import org.apache.sis.referencing.cs.HardCodedCS; - import static org.apache.sis.referencing.Assertions.assertEpsgNameAndIdentifierEqual; + import static org.apache.sis.test.Assertions.assertMessageContains; import static org.apache.sis.referencing.Assertions.assertWktEquals; + import static org.apache.sis.referencing.Assertions.assertEpsgNameAndIdentifierEqual; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import static org.opengis.test.Assertions.assertAxisDirectionsEqual; +// Specific to the main branch: +import static org.apache.sis.test.GeoapiAssert.assertAxisDirectionsEqual; /** diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java index ef409da246,ab740f9b77..e0b124853b --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java @@@ -70,9 -69,10 +69,10 @@@ import org.apache.sis.referencing.facto import static org.apache.sis.test.Assertions.assertNotDeepEquals; import static org.apache.sis.referencing.Assertions.assertEpsgNameAndIdentifierEqual; import static org.apache.sis.referencing.Assertions.assertAliasTipEquals; + import static org.apache.sis.test.TestCase.TAG_SLOW; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import static org.opengis.test.Assertions.assertAxisDirectionsEqual; +// Specific to the main branch: +import static org.apache.sis.test.GeoapiAssert.assertAxisDirectionsEqual; /** diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java index 9c38fe682c,d1351677a0..f36391004c --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java @@@ -37,15 -37,17 +37,17 @@@ import org.apache.sis.io.wkt.WKTFormat import org.apache.sis.referencing.operation.transform.MathTransformTestCase; // Test dependencies - import org.junit.jupiter.api.BeforeAll; - import org.junit.jupiter.api.AfterAll; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; - import static org.junit.jupiter.api.Assumptions.assumeTrue; + import org.junit.jupiter.api.TestInstance; import static org.junit.jupiter.api.Assertions.*; + import static org.junit.jupiter.api.Assumptions.assumeTrue; + import org.junit.jupiter.api.parallel.Execution; + import org.junit.jupiter.api.parallel.ExecutionMode; import static org.apache.sis.referencing.Assertions.assertEpsgNameAndIdentifierEqual; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.metadata.Identifier; +// Specific to the main branch: +import org.opengis.referencing.ReferenceIdentifier; /** diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/projection/NormalizedProjectionTest.java index ab91a3a431,4998b71c49..fc5e5ac815 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/projection/NormalizedProjectionTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/projection/NormalizedProjectionTest.java @@@ -22,9 -22,11 +22,11 @@@ import static org.apache.sis.metadata.i // Test dependencies import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.extension.ExtendWith; + import org.apache.sis.test.FailureDetailsReporter; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.test.referencing.TransformTestCase; +// Specific to the main branch: +import org.apache.sis.referencing.operation.transform.TransformTestCase; /** diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/provider/MapProjectionTest.java index 3233c1c0bd,6c4b1085e3..c1d3a99204 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/provider/MapProjectionTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/provider/MapProjectionTest.java @@@ -131,8 -131,8 +131,8 @@@ public final class MapProjectionTest ex assertEquals(isMandatory ? 1 : 0, actual.getMinimumOccurs()); if (epsgName != null) { for (final GenericName alias : actual.getAlias()) { - if (alias instanceof ReferenceIdentifier && ((ReferenceIdentifier) alias).getAuthority() != Citations.EPSG) { - assertOgcIdentifierEquals(ogcName, (ReferenceIdentifier) alias); - if (alias instanceof Identifier id && id.getAuthority() != Citations.EPSG) { ++ if (alias instanceof ReferenceIdentifier id && id.getAuthority() != Citations.EPSG) { + assertOgcIdentifierEquals(ogcName, id); return; } } diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/provider/NTv2Test.java index 6bfa7d6c42,fec3ece77d..e403e10527 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/provider/NTv2Test.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/provider/NTv2Test.java @@@ -44,10 -45,10 +45,10 @@@ import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assumptions.assumeTrue; import static org.junit.jupiter.api.Assertions.*; - import org.apache.sis.referencing.operation.gridded.LoadedGridTest; + import static org.apache.sis.test.TestCase.TAG_SLOW; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import static org.opengis.test.Assertions.assertMatrixEquals; +// Specific to the main branch: +import static org.apache.sis.test.GeoapiAssert.assertMatrixEquals; /** diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/CartesianToPolarTest.java index 7ce69ba874,f44d234e7b..9c448e1ad1 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/CartesianToPolarTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/CartesianToPolarTest.java @@@ -21,8 -21,13 +21,10 @@@ import org.opengis.referencing.operatio // Test dependencies import org.junit.jupiter.api.Test; + import org.junit.jupiter.api.extension.ExtendWith; + import org.apache.sis.test.FailureDetailsReporter; import org.apache.sis.test.TestUtilities; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.test.referencing.TransformTestCase; - /** * Tests {@link CartesianToPolar}. diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/CartesianToSphericalTest.java index ca8e24cb56,2688ab256a..9cdc5eb87c --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/CartesianToSphericalTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/CartesianToSphericalTest.java @@@ -25,8 -25,13 +25,10 @@@ import org.opengis.referencing.operatio import org.junit.jupiter.api.Test; import org.junit.jupiter.api.BeforeEach; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.extension.ExtendWith; + import org.apache.sis.test.FailureDetailsReporter; import org.apache.sis.test.TestUtilities; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.test.referencing.TransformTestCase; - /** * Tests {@link CartesianToSpherical}. diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/EllipsoidToCentricTransformTest.java index a6980ad829,fa28f39131..28de1c4cb2 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/EllipsoidToCentricTransformTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/EllipsoidToCentricTransformTest.java @@@ -33,9 -34,14 +34,11 @@@ import org.apache.sis.measure.Units // Test dependencies import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; - import org.apache.sis.referencing.operation.provider.GeocentricTranslationTest; + import org.junit.jupiter.api.extension.RegisterExtension; + import org.apache.sis.test.LoggingWatcher; import static org.apache.sis.test.Assertions.assertSerializedEquals; + import org.apache.sis.referencing.operation.provider.GeocentricTranslationTest; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.test.ToleranceModifier; - /** * Tests {@link EllipsoidToCentricTransform}. @@@ -110,9 -124,9 +121,10 @@@ public final class EllipsoidToCentricTr tolerance = GeocentricTranslationTest.precision(1); // Required precision for (λ,φ) zTolerance = Formulas.LINEAR_TOLERANCE / 2; // Required precision for h zDimension = new int[] {2}; // Dimension of h where to apply zTolerance + tolerance = 1E-4; // Other SIS branches use a stricter threshold. verifyTransform(GeocentricTranslationTest.samplePoint(2), // X = 3771793.968, Y = 140253.342, Z = 5124304.349 metres GeocentricTranslationTest.samplePoint(1)); // 53°48'33.820"N, 02°07'46.380"E, 73.00 metres + loggings.assertNoUnexpectedLog(); } /** @@@ -126,9 -140,10 +138,10 @@@ final double delta = toRadians(100.0 / 60) / 1852; // Approximately 100 metres derivativeDeltas = new double[] {delta, delta, 100}; // (Δλ, Δφ, Δh) tolerance = Formulas.LINEAR_TOLERANCE; - toleranceModifier = ToleranceModifier.PROJECTION; +// toleranceModifier = ToleranceModifier.PROJECTION; createGeodeticConversion(CommonCRS.WGS84.ellipsoid(), true); verifyInDomain(CoordinateDomain.GEOGRAPHIC, 306954540); + loggings.assertNoUnexpectedLog(); } /** @@@ -147,8 -162,9 +160,9 @@@ final double delta = toRadians(100.0 / 60) / 1852; derivativeDeltas = new double[] {delta, delta, 100}; tolerance = Formulas.LINEAR_TOLERANCE; - toleranceModifier = ToleranceModifier.PROJECTION; - verifyInverse(40, 30, 10000); +// toleranceModifier = ToleranceModifier.PROJECTION; + verifyInverse(new double[] {40, 30, 10000}); + loggings.assertNoUnexpectedLog(); } /** diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/LinearInterpolator1DTest.java index 6c2396d89c,764a56551d..e2257e0247 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/LinearInterpolator1DTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/LinearInterpolator1DTest.java @@@ -24,8 -24,13 +24,10 @@@ import org.opengis.referencing.operatio // Test dependencies import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.extension.ExtendWith; + import org.apache.sis.test.FailureDetailsReporter; import static org.apache.sis.test.Assertions.assertMessageContains; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.test.referencing.TransformTestCase; - /** * Test {@link LinearInterpolator1D} class. @@@ -33,7 -38,8 +35,8 @@@ * @author Rémi Maréchal (Geomatys) * @author Martin Desruisseaux (Geomatys). */ + @ExtendWith(FailureDetailsReporter.class) -public final class LinearInterpolator1DTest extends TransformTestCase { +public final class LinearInterpolator1DTest extends MathTransformTestCase { /** * The values of the <i>y=f(x)</i> function to test. */ diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java index 1d3371fa67,5bba742206..9c5b165bf2 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java @@@ -38,10 -38,18 +38,12 @@@ import org.apache.sis.referencing.opera // Test dependencies import static org.junit.jupiter.api.Assertions.*; - import org.opengis.test.Validators; + import org.junit.jupiter.api.extension.ExtendWith; + import org.apache.sis.test.FailureDetailsReporter; import org.apache.sis.test.TestUtilities; import org.apache.sis.referencing.Assertions; + import org.opengis.test.Validators; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.geometry.DirectPosition; -import org.apache.sis.measure.Longitude; -import org.opengis.test.CalculationType; -import org.opengis.test.referencing.TransformTestCase; - /** * Base class for tests of {@link AbstractMathTransform} implementations. @@@ -103,8 -120,71 +113,25 @@@ public abstract class MathTransformTest * Creates a new test case. */ protected MathTransformTestCase() { - /* - * Use `zTolerance` threshold instead of `tolerance` when comparing vertical coordinate values. - */ - toleranceModifier = (final double[] tolerances, final DirectPosition coordinates, final CalculationType mode) -> { - if (mode != CalculationType.IDENTITY) { - final int i = forComparison(zDimension, mode); - if (i >= 0 && i < tolerances.length) { - tolerances[i] = zTolerance; - } - } - }; } + /** + * Resets all fields that may be modified by test methods in this class. + * This is needed if the subclass reuses the same {@code TestCase} instance for all test methods. + * + * <p>The default implementation of this method does not reset the {@code isFooSupported} Boolean flags, + * on the assumption that subclasses do not modify them. Subclasses are responsible for restoring these + * flags if needed.</p> + */ + protected void reset() { + transform = null; + λDimension = null; + zDimension = null; + zTolerance = 0; + tolerance = 0; + derivativeDeltas = null; - configurationTip = null; - } - - /** - * Returns the value to use from the {@link #λDimension} or {@link zDimension} for the - * given comparison mode, or -1 if none. - */ - @SuppressWarnings("fallthrough") - private static int forComparison(final int[] config, final CalculationType mode) { - if (config != null) { - switch (mode) { - case INVERSE_TRANSFORM: if (config.length >= 2) return config[1]; // Intentional fallthrough. - case DIRECT_TRANSFORM: if (config.length >= 1) return config[0]; - } - } - return -1; - } - - /** - * Invoked by all {@code assertCoordinateEquals(…)} methods before two positions are compared. - * The SIS implementation ensures that longitude values are contained in the ±180° range, - * applying 360° shifts if needed. - * - * @param expected the expected coordinate values provided by the test case. - * @param actual the coordinate values computed by the {@linkplain #transform transform} being tested. - * @param mode indicates if the coordinates being compared are the result of a direct - * or inverse transform, or if strict equality is requested. - */ - @Override - protected final void normalize(final DirectPosition expected, final DirectPosition actual, final CalculationType mode) { - final int i = forComparison(λDimension, mode); - if (i >= 0) { - expected.setOrdinate(i, Longitude.normalize(expected.getOrdinate(i))); - actual .setOrdinate(i, Longitude.normalize(actual .getOrdinate(i))); - } + } + /** * Returns a name for the current math transform. This method is used only for reporting errors. * This information is not reliable for the actual tests as the names may not be stable. diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/PolarToCartesianTest.java index f4aab79c24,f858d2b948..d6b642bac4 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/PolarToCartesianTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/PolarToCartesianTest.java @@@ -22,8 -22,13 +22,10 @@@ import org.opengis.referencing.operatio // Test dependencies import org.junit.jupiter.api.Test; + import org.junit.jupiter.api.extension.ExtendWith; + import org.apache.sis.test.FailureDetailsReporter; import org.apache.sis.test.TestUtilities; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.test.referencing.TransformTestCase; - /** * Tests {@link PolarToCartesian}. diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java index 7a9a4a2e4b,167f12ade6..d8638c2788 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java @@@ -36,14 -35,15 +36,16 @@@ import org.apache.sis.math.Fraction // Test dependencies import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; + import org.junit.jupiter.api.extension.ExtendWith; + import org.apache.sis.test.FailureDetailsReporter; import org.opengis.test.Validators; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: +// Specific to the main branch: +import org.junit.jupiter.api.Disabled; import static org.junit.jupiter.api.Assertions.*; import static org.apache.sis.test.TestCase.STRICT; -import org.opengis.test.Assertions; -import org.opengis.test.referencing.AffineTransformTest; +import org.opengis.test.referencing.TransformTestCase; +import org.apache.sis.test.GeoapiAssert; /** @@@ -54,18 -54,8 +56,19 @@@ * * @author Martin Desruisseaux (Geomatys) */ +@SuppressWarnings("doclint:missing") + @ExtendWith(FailureDetailsReporter.class) -public class ProjectiveTransformTest extends AffineTransformTest { +public class ProjectiveTransformTest extends TransformTestCase { + /** + * The factory to use for creating linear transforms. + */ + private final MathTransformFactory mtFactory; + + /** + * The matrix for the tested transform. + */ + private Matrix matrix; + /** * A math transform factory which delegates instantiations to the enclosing test class. * This is a workaround for RFE #4093999 ("Relax constraint on placement of this()/super() diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/SphericalToCartesianTest.java index 6e27cb8a62,3aef1781ef..9b91460387 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/SphericalToCartesianTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/SphericalToCartesianTest.java @@@ -26,8 -26,13 +26,10 @@@ import org.opengis.referencing.operatio import org.junit.jupiter.api.Test; import org.junit.jupiter.api.BeforeEach; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.extension.ExtendWith; + import org.apache.sis.test.FailureDetailsReporter; import org.apache.sis.test.TestUtilities; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.test.referencing.TransformTestCase; - /** * Tests {@link SphericalToCartesian}. diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/test/integration/MetadataTest.java index 356f8dd92b,a88f9fe569..4b34d0d757 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/test/integration/MetadataTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/test/integration/MetadataTest.java @@@ -112,20 -91,9 +94,21 @@@ public final class MetadataTest extend * Creates a new test case. */ public MetadataTest() { + super(Loggers.XML); } + /** + * Creates a telephone number of the given type. + * + * @param type Either {@code "VOICE"}, {@code "FACSIMILE"} or {@code "SMS"}. + */ + private static DefaultTelephone telephone(final String number, final String type) { + final DefaultTelephone tel = new DefaultTelephone(); + tel.setNumber(number); + tel.setNumberType(UnsupportedCodeList.valueOf(type)); + return tel; + } + /** * Programmatically creates the metadata to marshal, or to compare against the unmarshalled metadata. * diff --cc endorsed/src/org.apache.sis.storage.netcdf/test/org/apache/sis/storage/netcdf/base/TestCase.java index 66592aec71,856a5242b1..892938ee66 --- a/endorsed/src/org.apache.sis.storage.netcdf/test/org/apache/sis/storage/netcdf/base/TestCase.java +++ b/endorsed/src/org.apache.sis.storage.netcdf/test/org/apache/sis/storage/netcdf/base/TestCase.java @@@ -35,8 -34,15 +34,12 @@@ import org.apache.sis.storage.event.Sto // Test dependencies import org.junit.jupiter.api.AfterAll; + import org.junit.jupiter.api.AfterEach; + 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; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.test.dataset.TestData; - /** * Base class of netCDF tests. The base class uses the UCAR decoder, which is taken as a reference implementation. diff --cc incubator/src/org.apache.sis.storage.shapefile/test/org/apache/sis/storage/shapefile/ShapefileStoreTest.java index bd710eca9d,c6c3df712a..3adaa30f0c --- a/incubator/src/org.apache.sis.storage.shapefile/test/org/apache/sis/storage/shapefile/ShapefileStoreTest.java +++ b/incubator/src/org.apache.sis.storage.shapefile/test/org/apache/sis/storage/shapefile/ShapefileStoreTest.java @@@ -45,12 -42,14 +42,13 @@@ import org.apache.sis.feature.internal. // Test dependencies import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; + import org.junit.jupiter.api.io.TempDir; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.feature.AttributeType; -import org.opengis.feature.Feature; -import org.opengis.feature.FeatureType; -import org.opengis.filter.BinaryComparisonOperator; -import org.opengis.filter.FilterFactory; +// Specific to the main branch: +import org.apache.sis.feature.AbstractFeature; +import org.apache.sis.feature.DefaultFeatureType; +import org.apache.sis.feature.DefaultAttributeType; +import org.apache.sis.filter.Filter; /** @@@ -249,11 -245,10 +244,10 @@@ public class ShapefileStoreTest * Test adding features to a shapefile. */ @Test - public void testAddFeatures() throws URISyntaxException, DataStoreException, IOException { - final Path folder = Files.createTempDirectory("shapefileTest"); + public void testAddFeatures(@TempDir final Path folder) throws URISyntaxException, DataStoreException, IOException { final Path temp = folder.resolve("test.shp"); try (final ShapefileStore store = new ShapefileStore(temp)) { - FeatureType type = createType(); + DefaultFeatureType type = createType(); store.updateType(type); type = store.getType(); @@@ -274,15 -267,14 +266,14 @@@ * Test remove features from a shapefile. */ @Test - public void testRemoveFeatures() throws DataStoreException, IOException { - final Path folder = Files.createTempDirectory("shapefileTest"); + public void testRemoveFeatures(@TempDir final Path folder) throws DataStoreException, IOException { final Path temp = folder.resolve("test.shp"); try (final ShapefileStore store = new ShapefileStore(temp)) { - FeatureType type = createType(); + DefaultFeatureType type = createType(); store.updateType(type); type = store.getType(); - Feature feature1 = createFeature1(type); - Feature feature2 = createFeature2(type); + AbstractFeature feature1 = createFeature1(type); + AbstractFeature feature2 = createFeature2(type); store.add(List.of(feature1, feature2).iterator()); //remove first feature @@@ -302,15 -292,14 +291,14 @@@ * Test replacing features in a shapefile. */ @Test - public void testReplaceFeatures() throws DataStoreException, IOException { - final Path folder = Files.createTempDirectory("shapefileTest"); + public void testReplaceFeatures(@TempDir final Path folder) throws DataStoreException, IOException { final Path temp = folder.resolve("test.shp"); try (final ShapefileStore store = new ShapefileStore(temp)) { - FeatureType type = createType(); + DefaultFeatureType type = createType(); store.updateType(type); type = store.getType(); - Feature feature1 = createFeature1(type); - Feature feature2 = createFeature2(type); + AbstractFeature feature1 = createFeature1(type); + AbstractFeature feature2 = createFeature2(type); store.add(List.of(feature1, feature2).iterator()); //remove first feature @@@ -326,11 -315,9 +314,9 @@@ Object[] result = store.features(false).toArray(); assertEquals(2, result.length); - Feature f1 = (Feature) result[0]; + AbstractFeature f1 = (AbstractFeature) result[0]; assertEquals(45, f1.getPropertyValue("id")); assertEquals(feature2, result[1]); - } finally { - deleteDirectory(folder); } }