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 acc896a725 Cleanup: - Use JUnit 5 runner for the `buildSrc` module. - Replace `assertFalse(a == b)` by `assertNotEquals(a, b)`. - Change argument order of assertion methods in `AnnotationConsistencyCheck` for consistency with JUnit 5 order. acc896a725 is described below commit acc896a7257e9316cfb55661a5b900b125e9f436 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Wed Feb 14 09:50:59 2024 +0100 Cleanup: - Use JUnit 5 runner for the `buildSrc` module. - Replace `assertFalse(a == b)` by `assertNotEquals(a, b)`. - Change argument order of assertion methods in `AnnotationConsistencyCheck` for consistency with JUnit 5 order. --- buildSrc/build.gradle.kts | 7 +- .../resources/IndexedResourceCompilerTest.java | 7 +- .../org/apache/sis/console/CommandRunnerTest.java | 2 +- .../org/apache/sis/feature/FeatureTestCase.java | 6 +- .../apache/sis/feature/SingletonAttributeTest.java | 2 +- .../apache/sis/metadata/MetadataStandardTest.java | 2 +- .../sis/metadata/PropertyConsistencyCheck.java | 60 +++++------ .../test/org/apache/sis/xml/XLinkTest.java | 12 +-- .../sis/xml/test/AnnotationConsistencyCheck.java | 117 +++++++++++---------- .../apache/sis/geometry/DirectPosition1DTest.java | 2 +- .../apache/sis/geometry/DirectPosition2DTest.java | 2 +- .../apache/sis/geometry/GeneralEnvelopeTest.java | 4 +- .../referencing/datum/BursaWolfParametersTest.java | 4 +- .../referencing/factory/sql/EPSGFactoryTest.java | 4 +- .../operation/DefaultConversionTest.java | 4 +- .../referencing/operation/matrix/MatricesTest.java | 2 +- .../operation/provider/ProvidersTest.java | 6 +- .../transform/DefaultMathTransformFactoryTest.java | 3 +- .../sis/test/integration/ConsistencyTest.java | 2 +- .../sis/storage/netcdf/base/VariableTest.java | 2 +- .../test/org/apache/sis/storage/gpx/TypesTest.java | 2 +- .../apache/sis/converter/NumberConverterTest.java | 2 +- .../test/org/apache/sis/math/StatisticsTest.java | 2 +- .../apache/sis/measure/LinearConverterTest.java | 6 +- .../org/apache/sis/measure/QuantitiesTest.java | 6 +- .../test/org/apache/sis/util/CharactersTest.java | 4 +- .../test/org/apache/sis/util/UtilitiesTest.java | 6 +- .../sis/util/collection/DefaultTreeTableTest.java | 4 +- .../apache/sis/util/collection/RangeSetTest.java | 2 +- .../apache/sis/util/internal/AbstractMapTest.java | 2 +- .../sis/map/service/GraphicsPortrayerTest.java | 4 +- 31 files changed, 143 insertions(+), 147 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index cfbc70ea94..630909921b 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -34,10 +34,9 @@ repositories { mavenCentral() } dependencies { - implementation (group = "org.apache.commons", name = "commons-compress", version = "1.23.0") - testCompileOnly(group = "junit", name = "junit", version = "4.13.2") - testRuntimeOnly(group = "org.junit.vintage", name = "junit-vintage-engine", version = "5.9.3") - testRuntimeOnly(group = "org.junit.platform", name = "junit-platform-launcher", version = "1.9.3") + implementation (group = "org.apache.commons", name = "commons-compress", version = "1.23.0") + testCompileOnly(group = "org.junit.jupiter", name = "junit-jupiter-api", version = "5.10.2") + testRuntimeOnly(group = "org.junit.jupiter", name = "junit-jupiter-engine", version = "5.10.2") } /* diff --git a/buildSrc/src/test/java/org/apache/sis/buildtools/resources/IndexedResourceCompilerTest.java b/buildSrc/src/test/java/org/apache/sis/buildtools/resources/IndexedResourceCompilerTest.java index 421c857c6b..8ea2d7eb9b 100644 --- a/buildSrc/src/test/java/org/apache/sis/buildtools/resources/IndexedResourceCompilerTest.java +++ b/buildSrc/src/test/java/org/apache/sis/buildtools/resources/IndexedResourceCompilerTest.java @@ -21,11 +21,8 @@ import java.util.Map; import java.util.TreeMap; // Test dependencies -import org.junit.Test; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; /** diff --git a/endorsed/src/org.apache.sis.console/test/org/apache/sis/console/CommandRunnerTest.java b/endorsed/src/org.apache.sis.console/test/org/apache/sis/console/CommandRunnerTest.java index d1247ead9d..b20b2eb9c3 100644 --- a/endorsed/src/org.apache.sis.console/test/org/apache/sis/console/CommandRunnerTest.java +++ b/endorsed/src/org.apache.sis.console/test/org/apache/sis/console/CommandRunnerTest.java @@ -180,6 +180,6 @@ public final class CommandRunnerTest extends TestCase { assertEquals("", c.outputBuffer.toString()); assertTrue(c.hasUnexpectedFileCount(2, 3)); String message = c.outputBuffer.toString(); - assertTrue(message.length() != 0); + assertNotEquals(0, message.length()); } } diff --git a/endorsed/src/org.apache.sis.feature/test/org/apache/sis/feature/FeatureTestCase.java b/endorsed/src/org.apache.sis.feature/test/org/apache/sis/feature/FeatureTestCase.java index c4fe780e81..d18ed745b0 100644 --- a/endorsed/src/org.apache.sis.feature/test/org/apache/sis/feature/FeatureTestCase.java +++ b/endorsed/src/org.apache.sis.feature/test/org/apache/sis/feature/FeatureTestCase.java @@ -394,12 +394,12 @@ public abstract class FeatureTestCase extends TestCase { final AbstractFeature clone = cloneFeature(); assertNotSame(clone, feature); assertTrue(clone.equals(feature)); - assertTrue(clone.hashCode() == feature.hashCode()); + assertEquals(clone.hashCode(), feature.hashCode()); setAttributeValue(property, oldValue, newValue); assertEquals(oldValue, clone .getPropertyValue(property), property); assertEquals(newValue, feature.getPropertyValue(property), property); - assertFalse(clone.equals(feature)); - assertFalse(clone.hashCode() == feature.hashCode()); + assertNotEquals(clone, feature); + assertNotEquals(clone.hashCode(), feature.hashCode()); } /** diff --git a/endorsed/src/org.apache.sis.feature/test/org/apache/sis/feature/SingletonAttributeTest.java b/endorsed/src/org.apache.sis.feature/test/org/apache/sis/feature/SingletonAttributeTest.java index 3fb6b8ecde..978743862c 100644 --- a/endorsed/src/org.apache.sis.feature/test/org/apache/sis/feature/SingletonAttributeTest.java +++ b/endorsed/src/org.apache.sis.feature/test/org/apache/sis/feature/SingletonAttributeTest.java @@ -154,7 +154,7 @@ public final class SingletonAttributeTest extends TestCase { assertEquals(a1.hashCode(), a2.hashCode()); a2.setValue(1000); assertFalse(a1.equals(a2)); - assertFalse(a1.hashCode() == a2.hashCode()); + assertNotEquals(a1.hashCode(), a2.hashCode()); } /** diff --git a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/MetadataStandardTest.java b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/MetadataStandardTest.java index a445d462bd..dbb92cf9c3 100644 --- a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/MetadataStandardTest.java +++ b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/MetadataStandardTest.java @@ -251,7 +251,7 @@ public final class MetadataStandardTest extends TestCase { final var platform = (DefaultPlatform) getSingleton(p2.getPlatforms()); final var instrument = (DefaultInstrument) getSingleton(platform.getInstruments()); instrument.setType(new SimpleInternationalString("Another instrument type.")); - assertFalse(p1.equals(p2)); + assertNotEquals(p1, p2); } /** diff --git a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/PropertyConsistencyCheck.java b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/PropertyConsistencyCheck.java index 9fa86d38b4..fef17e6525 100644 --- a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/PropertyConsistencyCheck.java +++ b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/PropertyConsistencyCheck.java @@ -84,9 +84,9 @@ public abstract class PropertyConsistencyCheck extends AnnotationConsistencyChec */ @Override protected <T> Class<? extends T> getImplementation(final Class<T> type) { - assertTrue(type.getName(), standard.isMetadata(type)); + assertTrue(standard.isMetadata(type), type.getName()); final Class<? extends T> impl = standard.getImplementation(type); - assertNotNull(type.getName(), impl); + assertNotNull(impl, type.getName()); return impl; } @@ -179,7 +179,7 @@ public abstract class PropertyConsistencyCheck extends AnnotationConsistencyChec * @param metadata the metadata to validate. */ protected void validate(final AbstractMetadata metadata) { - assertTrue("AbstractMetadata.isEmpty()", metadata.isEmpty()); + assertTrue(metadata.isEmpty(), "AbstractMetadata.isEmpty()"); } /** @@ -195,7 +195,7 @@ public abstract class PropertyConsistencyCheck extends AnnotationConsistencyChec if (!ControlledVocabulary.class.isAssignableFrom(type)) { final Class<?> impl = getImplementation(type); if (impl != null) { - assertTrue("Not an implementation of expected interface.", type.isAssignableFrom(impl)); + assertTrue(type.isAssignableFrom(impl), "Not an implementation of expected interface."); testPropertyValues(new PropertyAccessor(type, impl, impl)); } } @@ -233,39 +233,39 @@ public abstract class PropertyConsistencyCheck extends AnnotationConsistencyChec continue; } final String property = accessor.name(i, KeyNamePolicy.JAVABEANS_PROPERTY); - assertNotNull("Missing method name.", testingMethod); - assertNotNull("Missing property name.", property); - assertEquals("Wrong property index.", i, accessor.indexOf(property, true)); + assertNotNull(testingMethod, "Missing method name."); + assertNotNull(property, "Missing property name."); + assertEquals(i, accessor.indexOf(property, true), "Wrong property index."); /* * Get the property type. In the special case where the property type * is a collection, this is the type of elements in that collection. */ final Class<?> propertyType = Numbers.primitiveToWrapper(accessor.type(i, TypeValuePolicy.PROPERTY_TYPE)); final Class<?> elementType = Numbers.primitiveToWrapper(accessor.type(i, TypeValuePolicy.ELEMENT_TYPE)); - assertNotNull(testingMethod, propertyType); - assertNotNull(testingMethod, elementType); + assertNotNull(propertyType, testingMethod); + assertNotNull(elementType, testingMethod); final boolean isMap = Map.class.isAssignableFrom(propertyType); final boolean isCollection = Collection.class.isAssignableFrom(propertyType); - assertFalse("Element type cannot be Collection.", Collection.class.isAssignableFrom(elementType)); - assertEquals("Property and element types shall be the same if and only if not a collection.", - !(isMap | isCollection), propertyType == elementType); + assertFalse(Collection.class.isAssignableFrom(elementType), "Element type cannot be Collection."); + assertEquals(!(isMap | isCollection), propertyType == elementType, + "Property and element types shall be the same if and only if not a collection."); /* * Try to get a value. */ Object value = accessor.get(i, instance); if (value == null) { - assertFalse("Null values are not allowed to be collections.", isMap | isCollection); + assertFalse(isMap | isCollection, "Null values are not allowed to be collections."); } else { - assertTrue("Wrong property type.", propertyType.isInstance(value)); + assertTrue(propertyType.isInstance(value), "Wrong property type."); if (value instanceof CheckedContainer<?>) { - assertTrue("Wrong element type in collection.", - elementType.isAssignableFrom(((CheckedContainer<?>) value).getElementType())); + assertTrue(elementType.isAssignableFrom(((CheckedContainer<?>) value).getElementType()), + "Wrong element type in collection."); } if (isMap) { - assertTrue("Collections shall be initially empty.", ((Map<?,?>) value).isEmpty()); + assertTrue(((Map<?,?>) value).isEmpty(), "Collections shall be initially empty."); value = CollectionsExt.modifiableCopy((Map<?,?>) value); // Protect from changes. } else if (isCollection) { - assertTrue("Collections shall be initially empty.", ((Collection<?>) value).isEmpty()); + assertTrue(((Collection<?>) value).isEmpty(), "Collections shall be initially empty."); value = CollectionsExt.modifiableCopy((Collection<?>) value); // Protect from changes. } } @@ -282,19 +282,19 @@ public abstract class PropertyConsistencyCheck extends AnnotationConsistencyChec } final Object newValue = sampleValueFor(property, elementType); final Object oldValue = accessor.set(i, instance, newValue, PropertyAccessor.RETURN_PREVIOUS); - assertEquals("PropertyAccessor.set(…) shall return the value previously returned by get(…).", value, oldValue); + assertEquals(value, oldValue, "PropertyAccessor.set(…) shall return the value previously returned by get(…)."); value = accessor.get(i, instance); if (isCollection) { if (newValue == null) { - assertTrue("We did not generated a random value for this type, consequently the " - + "collection should still empty.", ((Collection<?>) value).isEmpty()); + assertTrue(((Collection<?>) value).isEmpty(), "We did not generated a random value" + + " for this type, consequently the collection should still empty."); value = null; } else { value = TestUtilities.getSingleton((Collection<?>) value); } } - assertEquals("PropertyAccessor.get(…) shall return the value that we have just set.", - normalizeType(newValue), normalizeType(value)); + assertEquals(normalizeType(newValue), normalizeType(value), + "PropertyAccessor.get(…) shall return the value that we have just set."); } } } @@ -334,14 +334,14 @@ public abstract class PropertyConsistencyCheck extends AnnotationConsistencyChec // Property shall exist. final int index = accessor.indexOf(name, false); - assertTrue(message, index >= 0); + assertTrue(index >= 0, message); // Property cannot be a metadata. final Class<?> elementType = accessor.type(index, TypeValuePolicy.ELEMENT_TYPE); - assertFalse(message, standard.isMetadata(elementType)); + assertFalse(standard.isMetadata(elementType), message); // Property shall be a singleton. - assertSame(message, elementType, accessor.type(index, TypeValuePolicy.PROPERTY_TYPE)); + assertSame(elementType, accessor.type(index, TypeValuePolicy.PROPERTY_TYPE), message); } } } @@ -371,8 +371,8 @@ public abstract class PropertyConsistencyCheck extends AnnotationConsistencyChec * Currently, @Dependencies is applied only on deprecated getter methods. * However, this policy may change in future Apache SIS versions. */ - assertTrue(name, name.startsWith("get")); - assertTrue(name, method.isAnnotationPresent(Deprecated.class)); + assertTrue(name.startsWith("get"), name); + assertTrue(method.isAnnotationPresent(Deprecated.class), name); /* * All dependencies shall be non-deprecated methods. Combined with above * restriction about @Dependencies applied only on deprected methods, this @@ -380,10 +380,10 @@ public abstract class PropertyConsistencyCheck extends AnnotationConsistencyChec */ for (final String ref : dep.value()) { // Verify that the dependency is a property name. - assertEquals(name, names.get(ref), ref); + assertEquals(names.get(ref), ref, name); // Verify that the referenced method is non-deprecated. - assertFalse(name, impl.getMethod(names.get(ref)).isAnnotationPresent(Deprecated.class)); + assertFalse(impl.getMethod(names.get(ref)).isAnnotationPresent(Deprecated.class), name); } } } diff --git a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/XLinkTest.java b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/XLinkTest.java index c06709dc47..a745ed93d0 100644 --- a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/XLinkTest.java +++ b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/XLinkTest.java @@ -62,7 +62,7 @@ public final class XLinkTest extends TestCase { public void testGetType() throws URISyntaxException { final XLink link = new XLink(); int hashCode = link.hashCode(); - assertFalse(hashCode == 0); + assertNotEquals(0, hashCode); assertNull(link.getType()); link.setType(XLink.Type.AUTO); @@ -166,22 +166,22 @@ public final class XLinkTest extends TestCase { final XLink other = new XLink(); assertFalse(link.equals(other)); - assertFalse(link.hashCode() == other.hashCode()); + assertNotEquals(link.hashCode(), other.hashCode()); other.setType(XLink.Type.AUTO); assertFalse(link.equals(other)); - assertFalse(link.hashCode() == other.hashCode()); + assertNotEquals(link.hashCode(), other.hashCode()); other.setRole(new URI("org:apache:sis:role")); assertFalse(link.equals(other)); - assertFalse(link.hashCode() == other.hashCode()); + assertNotEquals(link.hashCode(), other.hashCode()); other.setTitle(new SimpleInternationalString("Some title")); - assertEquals(link, other); + assertTrue(link.equals(other)); assertEquals(link.hashCode(), other.hashCode()); other.freeze(); - assertEquals(link, other); + assertTrue(link.equals(other)); assertEquals(link.hashCode(), other.hashCode()); } } diff --git 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 index 986a269b08..45ba11905a 100644 --- 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 @@ -253,14 +253,14 @@ public abstract class AnnotationConsistencyCheck extends TestCase { case "SV_OperationMetadata": case "SV_OperationChainMetadata": case "SV_ServiceIdentification": { // Historical reasons (other standard integrated into ISO 19115) - assertEquals("Unexpected @Specification value.", Specification.ISO_19115, uml.specification()); - assertEquals("Specification version should be latest ISO 19115.", (short) 0, uml.version()); + assertEquals(Specification.ISO_19115, uml.specification(), "Unexpected @Specification value."); + assertEquals((short) 0, uml.version(), "Specification version should be latest ISO 19115."); return Namespaces.SRV; } case "DQ_TemporalAccuracy": // Renamed DQ_TemporalQuality case "DQ_NonQuantitativeAttributeAccuracy": { // Renamed DQ_NonQuantitativeAttributeCorrectness - assertEquals("Unexpected @Specification value.", Specification.ISO_19115, uml.specification()); - assertEquals("Specification version should be legacy ISO 19115.", (short) 2003, uml.version()); + assertEquals(Specification.ISO_19115, uml.specification(), "Unexpected @Specification value."); + assertEquals((short) 2003, uml.version(), "Specification version should be legacy ISO 19115."); return LegacyNamespaces.GMD; } case "role": { @@ -306,18 +306,18 @@ public abstract class AnnotationConsistencyCheck extends TestCase { } } if (identifier.startsWith("DQ_")) { - assertEquals("Unexpected @Specification value.", Specification.ISO_19157, uml.specification()); - assertEquals("Specification version should be ISO 19157.", (short) 0, uml.version()); + assertEquals(Specification.ISO_19157, uml.specification(), "Unexpected @Specification value."); + assertEquals((short) 0, uml.version(), "Specification version should be ISO 19157."); return Namespaces.MDQ; } if (identifier.startsWith("DQM_")) { - assertEquals("Unexpected @Specification value.", Specification.ISO_19157, uml.specification()); - assertEquals("Specification version should be ISO 19157.", (short) 0, uml.version()); + assertEquals(Specification.ISO_19157, uml.specification(), "Unexpected @Specification value."); + assertEquals((short) 0, uml.version(), "Specification version should be ISO 19157."); return Namespaces.DQM; } if (identifier.startsWith("QE_")) { - assertEquals("Unexpected @Specification value.", Specification.ISO_19115_2, uml.specification()); - assertEquals("Specification version should be legacy ISO 19115-2.", (short) 2009, uml.version()); + assertEquals(Specification.ISO_19115_2, uml.specification(), "Unexpected @Specification value."); + assertEquals((short) 2009, uml.version(), "Specification version should be legacy ISO 19115-2."); return LegacyNamespaces.GMI; } /* @@ -449,16 +449,16 @@ public abstract class AnnotationConsistencyCheck extends TestCase { * @return the actual namespace (same as {@code namespace} if it was not {@value #DEFAULT}). */ private String assertExpectedNamespace(String namespace, final Class<?> impl, final UML uml) { - assertNotNull("Missing namespace.", namespace); - assertFalse("Missing namespace.", namespace.trim().isEmpty()); + assertNotNull(namespace, "Missing namespace."); + assertFalse(namespace.trim().isEmpty(), "Missing namespace."); /* * Get the namespace declared at the package level, and ensure the * given namespace is not redundant with that package-level namespace. */ final XmlSchema schema = impl.getPackage().getAnnotation(XmlSchema.class); - assertNotNull("Missing @XmlSchema annotation in package-info.", schema); + assertNotNull(schema, "Missing @XmlSchema annotation in package-info."); final String schemaNamespace = schema.namespace(); // May be XMLConstants.NULL_NS_URI - assertFalse("Namespace declaration is redundant with package-info @XmlSchema.", namespace.equals(schemaNamespace)); + assertFalse(namespace.equals(schemaNamespace), "Namespace declaration is redundant with package-info @XmlSchema."); /* * Resolve the namespace given in argument: using the class-level namespace if needed, * or the package-level namespace if the class-level one is not defined. @@ -468,12 +468,12 @@ public abstract class AnnotationConsistencyCheck extends TestCase { if (type == null || DEFAULT.equals(namespace = type.namespace())) { namespace = schemaNamespace; } - assertFalse("No namespace defined.", XMLConstants.NULL_NS_URI.equals(namespace)); + assertFalse(XMLConstants.NULL_NS_URI.equals(namespace), "No namespace defined."); } /* * Check that the namespace is declared in the package-level @XmlNs annotation. * We do not verify the validity of those @XmlNs annotations, since this is the - * purpose of the 'testPackageAnnotations()' method. + * purpose of the `testPackageAnnotations()` method. */ boolean found = false; for (final XmlNs ns : schema.xmlns()) { @@ -628,7 +628,7 @@ public abstract class AnnotationConsistencyCheck extends TestCase { testingMethod = null; testingClass = type.getCanonicalName(); UML uml = type.getAnnotation(UML.class); - assertNotNull("Missing @UML annotation.", uml); + assertNotNull(uml, "Missing @UML annotation."); if (!ControlledVocabulary.class.isAssignableFrom(type)) { for (final Method method : type.getDeclaredMethods()) { if (isPublic(method)) { @@ -636,7 +636,7 @@ public abstract class AnnotationConsistencyCheck extends TestCase { if (!isIgnored(method)) { uml = method.getAnnotation(UML.class); if (!method.isAnnotationPresent(Deprecated.class)) { - assertNotNull("Missing @UML annotation.", uml); + assertNotNull(uml, "Missing @UML annotation."); } } } @@ -664,7 +664,7 @@ public abstract class AnnotationConsistencyCheck extends TestCase { if (impl != null) { testingClass = impl.getCanonicalName(); final Package p = impl.getPackage(); - assertNotNull("Missing package information.", p); + assertNotNull(p, "Missing package information."); packages.add(p); } } @@ -673,7 +673,7 @@ public abstract class AnnotationConsistencyCheck extends TestCase { for (final XmlNs ns : p.getAnnotation(XmlSchema.class).xmlns()) { testingClass = p.getName(); final String namespace = ns.namespaceURI(); - assertEquals("Unexpected namespace prefix.", Namespaces.getPreferredPrefix(namespace, null), ns.prefix()); + assertEquals(Namespaces.getPreferredPrefix(namespace, null), ns.prefix(), "Unexpected namespace prefix."); } } } @@ -706,21 +706,21 @@ public abstract class AnnotationConsistencyCheck extends TestCase { testingClass = type.getCanonicalName(); /* * Get the implementation class, which is mandatory (otherwise the - * subclass shall not include the interface in the 'types' array). + * subclass shall not include the interface in the `types` array). */ final Class<?> impl = getImplementation(type); - assertNotNull("No implementation found.", impl); - assertNotSame("No implementation found.", type, impl); + assertNotNull(impl, "No implementation found."); + assertNotSame(type, impl, "No implementation found."); testingClass = impl.getCanonicalName(); /* * Compare the XmlRootElement with the UML annotation, if any. The UML annotation - * is mandatory in the default implementation of the 'testInterfaceAnnotations()' + * is mandatory in the default implementation of the `testInterfaceAnnotations()` * method, but we don't require the UML to be non-null here since this is not the * job of this test method. This is because subclasses may choose to override the - * 'testInterfaceAnnotations()' method. + * `testInterfaceAnnotations()` method. */ final XmlRootElement root = impl.getAnnotation(XmlRootElement.class); - assertNotNull("Missing @XmlRootElement annotation.", root); + assertNotNull(root, "Missing @XmlRootElement annotation."); final UML uml = type.getAnnotation(UML.class); Stereotype stereotype = null; if (uml != null) { @@ -728,7 +728,7 @@ public abstract class AnnotationConsistencyCheck extends TestCase { if (c != null) { stereotype = c.value(); } - assertEquals("Wrong @XmlRootElement.name().", getExpectedXmlRootElementName(stereotype, uml), root.name()); + assertEquals(getExpectedXmlRootElementName(stereotype, uml), root.name(), "Wrong @XmlRootElement.name()."); } /* * Check that the namespace is the expected one (according subclass) @@ -739,12 +739,12 @@ public abstract class AnnotationConsistencyCheck extends TestCase { * Compare the XmlType annotation with the expected value. */ final XmlType xmlType = impl.getAnnotation(XmlType.class); - assertNotNull("Missing @XmlType annotation.", xmlType); + assertNotNull(xmlType, "Missing @XmlType annotation."); String expected = getExpectedXmlTypeName(stereotype, uml); if (expected == null) { expected = DEFAULT; } - assertEquals("Wrong @XmlType.name().", expected, xmlType.name()); + assertEquals(expected, xmlType.name(), "Wrong @XmlType.name()."); } } @@ -771,7 +771,7 @@ public abstract class AnnotationConsistencyCheck extends TestCase { final Class<?> impl = getImplementation(type); if (impl == null) { /* - * Implementation existence are tested by 'testImplementationAnnotations()'. + * Implementation existence are tested by `testImplementationAnnotations()`. * It is not the purpose of this test to verify again their existence. */ continue; @@ -822,7 +822,7 @@ public abstract class AnnotationConsistencyCheck extends TestCase { */ if (element == null) try { element = impl.getDeclaredField(identifier).getAnnotation(XmlElement.class); - assertNotNull("Missing @XmlElement annotation.", element); + assertNotNull(element, "Missing @XmlElement annotation."); } catch (NoSuchFieldException e) { fail("Missing @XmlElement annotation."); continue; // As a metter of principle (should never reach this point). @@ -830,14 +830,14 @@ public abstract class AnnotationConsistencyCheck extends TestCase { } /* * The UML annotation is mandatory in the default implementation of the - * 'testInterfaceAnnotations()' method, but we don't require the UML to + * `testInterfaceAnnotations()` method, but we don't require the UML to * be non-null here since this is not the job of this test method. This * is because subclasses may choose to override the above test method. */ if (uml != null) { - assertEquals("Wrong @XmlElement.name().", getExpectedXmlElementName(type, uml), element.name()); + assertEquals(getExpectedXmlElementName(type, uml), element.name(), "Wrong @XmlElement.name()."); if (!method.isAnnotationPresent(Deprecated.class) && uml.version() == 0) { - assertEquals("Wrong @XmlElement.required().", uml.obligation() == Obligation.MANDATORY, element.required()); + assertEquals(uml.obligation() == Obligation.MANDATORY, element.required(), "Wrong @XmlElement.required()."); } } /* @@ -906,31 +906,32 @@ public abstract class AnnotationConsistencyCheck extends TestCase { fail(e.toString()); continue; } - assertEquals("The setter method must be declared in the same class as the " + - "getter method - not in a parent class, to avoid issues with JAXB.", - getter.getDeclaringClass(), setter.getDeclaringClass()); - assertEquals("The setter parameter type shall be the same as the getter return type.", - getter.getReturnType(), TestUtilities.getSingleton(setter.getParameterTypes())); + assertEquals(getter.getDeclaringClass(), setter.getDeclaringClass(), + "The setter method must be declared in the same class as the " + + "getter method - not in a parent class, to avoid issues with JAXB."); + assertEquals(getter.getReturnType(), TestUtilities.getSingleton(setter.getParameterTypes()), + "The setter parameter type shall be the same as the getter return type."); element = getter.getAnnotation(XmlElement.class); - assertEquals("Expected @XmlElement XOR @XmlElementRef.", (element == null), + assertEquals((element == null), getter.isAnnotationPresent(XmlElementRef.class) || - getter.isAnnotationPresent(XmlElementRefs.class)); + getter.isAnnotationPresent(XmlElementRefs.class), + "Expected @XmlElement XOR @XmlElementRef."); } /* * If the annotation is @XmlElement, ensure that XmlElement.name() is equal * to the UML identifier. Then verify that the namespace is the expected one. */ if (element != null) { - assertFalse("Expected @XmlElementRef.", wrapper.isInherited); + assertFalse(wrapper.isInherited, "Expected @XmlElementRef."); final UML uml = type.getAnnotation(UML.class); - if (uml != null) { // 'assertNotNull' is 'testInterfaceAnnotations()' job. - assertEquals("Wrong @XmlElement.", getExpectedXmlRootElementName(null, uml), element.name()); + if (uml != null) { // `assertNotNull` is `testInterfaceAnnotations()` job. + assertEquals(getExpectedXmlRootElementName(null, uml), element.name(), "Wrong @XmlElement."); } final String namespace = assertExpectedNamespace(element.namespace(), wrapper.type, uml); if (!ControlledVocabulary.class.isAssignableFrom(type)) { final String expected = getNamespace(getImplementation(type)); - if (expected != null) { // 'assertNotNull' is 'testImplementationAnnotations()' job. - assertEquals("Inconsistent @XmlRootElement namespace.", expected, namespace); + if (expected != null) { // `assertNotNull` is `testImplementationAnnotations()` job. + assertEquals(expected, namespace, "Inconsistent @XmlRootElement namespace."); } } } @@ -970,10 +971,10 @@ public abstract class AnnotationConsistencyCheck extends TestCase { * {@link assertTrue(boolean, String)} method except that the error message contains the * {@link #testingClass} and {@link #testingMethod}. * - * @param message the message in case of failure. * @param condition the condition that must be {@code true}. + * @param message the message in case of failure. */ - protected final void assertTrue(final String message, final boolean condition) { + protected final void assertTrue(final boolean condition, final String message) { if (!condition) throw new AssertionFailedError(location(message)); } @@ -982,10 +983,10 @@ public abstract class AnnotationConsistencyCheck extends TestCase { * {@code assertFalse(boolean, String)} method except that the error message contains the * {@link #testingClass} and {@link #testingMethod}. * - * @param message the message in case of failure. * @param condition the condition that must be {@code false}. + * @param message the message in case of failure. */ - protected final void assertFalse(final String message, final boolean condition) { + protected final void assertFalse(final boolean condition, final String message) { if (condition) throw new AssertionFailedError(location(message)); } @@ -994,10 +995,10 @@ public abstract class AnnotationConsistencyCheck extends TestCase { * {@code assertNotNull(Object, String)} method except that the error message contains * the {@link #testingClass} and {@link #testingMethod}. * - * @param message the message in case of failure. * @param obj the object that must be non-null. + * @param message the message in case of failure. */ - protected final void assertNotNull(final String message, final Object obj) { + protected final void assertNotNull(final Object obj, final String message) { if (obj == null) throw new AssertionFailedError(location(message)); } @@ -1006,11 +1007,11 @@ public abstract class AnnotationConsistencyCheck extends TestCase { * {@code assertNotSame(Object, Object, String)} except that the error message contains the * {@link #testingClass} and {@link #testingMethod}. * - * @param message the message in case of failure. * @param o1 the first object (may be null). * @param o2 the second object (may be null). + * @param message the message in case of failure. */ - protected final void assertNotSame(final String message, final Object o1, final Object o2) { + protected final void assertNotSame(final Object o1, final Object o2, final String message) { if (o1 == o2) throw new AssertionFailedError(location(message)); } @@ -1019,11 +1020,11 @@ public abstract class AnnotationConsistencyCheck extends TestCase { * {@code assertSame(Object, Object, String)} method except that the error message contains * the {@link #testingClass} and {@link #testingMethod}. * - * @param message the message in case of failure. * @param expected the first object (may be null). * @param actual the second object (may be null). + * @param message the message in case of failure. */ - protected final void assertSame(final String message, final Object expected, final Object actual) { + protected final void assertSame(final Object expected, final Object actual, final String message) { if (expected != actual) throw new AssertionFailedError(location(message)); } @@ -1032,11 +1033,11 @@ public abstract class AnnotationConsistencyCheck extends TestCase { * {@code assertEquals(String, Object, Object)} except that the error * message contains the {@link #testingClass} and {@link #testingMethod}. * - * @param message the message in case of failure. * @param expected the first object (may be null). * @param actual the second object (may be null). + * @param message the message in case of failure. */ - protected final void assertEquals(final String message, final Object expected, final Object actual) { + protected final void assertEquals(final Object expected, final Object actual, final String message) { if (!Objects.equals(expected, actual)) { throw new AssertionFailedError(location(message) + System.lineSeparator() + "Expected " + expected + " but got " + actual); diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/DirectPosition1DTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/DirectPosition1DTest.java index 6105916c4e..fd1378645b 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/DirectPosition1DTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/DirectPosition1DTest.java @@ -78,7 +78,7 @@ public final class DirectPosition1DTest extends TestCase { p1.setOrdinate(0, p1.getOrdinate(0) + 1); assertFalse(p1.equals(p2)); assertFalse(p2.equals(p1)); - assertFalse(p2.hashCode() == p1.hashCode()); + assertNotEquals(p2.hashCode(), p1.hashCode()); } /** diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/DirectPosition2DTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/DirectPosition2DTest.java index 105d7c8e03..45934d923f 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/DirectPosition2DTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/DirectPosition2DTest.java @@ -78,7 +78,7 @@ public final class DirectPosition2DTest extends TestCase { p1.setOrdinate(0, p1.getOrdinate(0) + 1); assertFalse(p1.equals(p2)); assertFalse(p2.equals(p1)); - assertFalse(p2.hashCode() == p1.hashCode()); + assertNotEquals(p2.hashCode(), p1.hashCode()); } /** diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/GeneralEnvelopeTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/GeneralEnvelopeTest.java index 38ae6c6ef4..80b07bb3e6 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/GeneralEnvelopeTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/geometry/GeneralEnvelopeTest.java @@ -804,7 +804,7 @@ public class GeneralEnvelopeTest extends TestCase { assertFalse(e1.equals (e2)); assertTrue (e1.equals (e2, EPS, true )); assertTrue (e1.equals (e2, EPS, false)); - assertFalse(e1.hashCode() == e2.hashCode()); + assertNotEquals(e1.hashCode(), e2.hashCode()); /* * Applies a greater offset. Should not be equal, * even when comparing with a tolerance value. @@ -815,7 +815,7 @@ public class GeneralEnvelopeTest extends TestCase { assertFalse(e1.equals (e2)); assertFalse(e1.equals (e2, EPS, true )); assertFalse(e1.equals (e2, EPS, false)); - assertFalse(e1.hashCode() == e2.hashCode()); + assertNotEquals(e1.hashCode(), e2.hashCode()); } /** diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/datum/BursaWolfParametersTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/datum/BursaWolfParametersTest.java index 0553db5702..51483160d3 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/datum/BursaWolfParametersTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/datum/BursaWolfParametersTest.java @@ -142,10 +142,10 @@ public final class BursaWolfParametersTest extends TestCase { @Test @DependsOnMethod("testGetValues") public void testSetValues() { - final BursaWolfParameters actual = createWGS72_to_WGS84(); + final BursaWolfParameters actual = createWGS72_to_WGS84(); final BursaWolfParameters expected = createED87_to_WGS84(); final double[] values = expected.getValues(); - assertFalse(actual.equals(expected)); + assertNotEquals(expected, actual); actual.setValues(values); assertArrayEquals(values, actual.getValues()); // Cannot test assertEquals(expected, actual) because of different geographic extent. diff --git 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 index f20da88d25..eee6460c8f 100644 --- 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 @@ -888,7 +888,7 @@ public final class EPSGFactoryTest extends TestCase { assertSame (sourceCRS, operation2.getSourceCRS()); assertSame (targetCRS, operation2.getTargetCRS()); assertFalse(operation2.getMathTransform().isIdentity()); - assertFalse(transform.equals(operation2.getMathTransform()), "Should be a more accurate transformation."); + assertNotEquals(transform, operation2.getMathTransform(), "Should be a more accurate transformation."); assertEquals(1.5, AbstractCoordinateOperation.castOrCopy(operation2).getLinearAccuracy()); /* * ED50 (4230) to WGS 84 (4326) using @@ -901,7 +901,7 @@ public final class EPSGFactoryTest extends TestCase { assertSame (sourceCRS, operation3.getSourceCRS()); assertSame (targetCRS, operation3.getTargetCRS()); assertFalse(operation3.getMathTransform().isIdentity()); - assertFalse(transform.equals(operation3.getMathTransform()), "Should be a more accurate transformation."); + assertNotEquals(transform, operation3.getMathTransform(), "Should be a more accurate transformation."); assertEquals(1.0, AbstractCoordinateOperation.castOrCopy(operation3).getLinearAccuracy()); /* * Creates from CRS codes. There is 40 such operations in EPSG version 6.7. diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/DefaultConversionTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/DefaultConversionTest.java index 43b976e24d..98988362e1 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/DefaultConversionTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/DefaultConversionTest.java @@ -239,8 +239,8 @@ public final class DefaultConversionTest extends TestCase { */ assertNull(definingConversion.getSourceCRS()); assertNull(definingConversion.getTargetCRS()); - assertFalse(definingConversion.equals(reference)); - assertFalse(reference.equals(definingConversion)); + assertNotEquals(definingConversion, reference); + assertNotEquals(reference, definingConversion); /* * Now create a normal conversion from the defining one, * but add a swapping of (latitude, longitude) axes. diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/matrix/MatricesTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/matrix/MatricesTest.java index 22d5f6e010..1065e449c2 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/matrix/MatricesTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/matrix/MatricesTest.java @@ -79,7 +79,7 @@ public final class MatricesTest extends TestCase { final MatrixSIS matrix = Matrices.create(SIZE, SIZE, elements); assertExtendedPrecision(matrix); - assertFalse(expected.equals(matrix)); + assertNotEquals(expected, matrix); assertTrue(Matrices.equals(expected, matrix, ComparisonMode.BY_CONTRACT)); } diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/provider/ProvidersTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/provider/ProvidersTest.java index 4e31a46ee5..166bd76cda 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/provider/ProvidersTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/provider/ProvidersTest.java @@ -285,8 +285,8 @@ public final class ProvidersTest extends TestCase { */ @Test public void testDescription() { - assertFalse(SatelliteTracking.SATELLITE_ORBIT_INCLINATION.getDescription().length() == 0); - assertFalse(SatelliteTracking.SATELLITE_ORBITAL_PERIOD .getDescription().length() == 0); - assertFalse(SatelliteTracking.ASCENDING_NODE_PERIOD .getDescription().length() == 0); + assertNotEquals(0, SatelliteTracking.SATELLITE_ORBIT_INCLINATION.getDescription().length()); + assertNotEquals(0, SatelliteTracking.SATELLITE_ORBITAL_PERIOD .getDescription().length()); + assertNotEquals(0, SatelliteTracking.ASCENDING_NODE_PERIOD .getDescription().length()); } } diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java index 89e6aa8130..fdca1b8021 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java @@ -284,8 +284,7 @@ public final class DefaultMathTransformFactoryTest extends TestCase { if (mt instanceof LinearTransform) { continue; } - assertInstanceOf(Parameterized.class, mt, classification); - pg = ((Parameterized) mt).getParameterValues(); + pg = assertInstanceOf(Parameterized.class, mt, classification).getParameterValues(); assertNotNull(pg, classification); assertEquals(pg.getDescriptor().getName().getCode(), classification); assertEquals(6377563.396, pg.parameter("semi_major").doubleValue(), 1E-4, classification); diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/test/integration/ConsistencyTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/test/integration/ConsistencyTest.java index e953fc8cbd..ba6672ca1e 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/test/integration/ConsistencyTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/test/integration/ConsistencyTest.java @@ -261,7 +261,7 @@ public final class ConsistencyTest extends TestCase { private void lookup(final CoordinateReferenceSystem parsed, final CoordinateReferenceSystem crs) throws FactoryException { final Identifier id = IdentifiedObjects.getIdentifier(crs, null); final String urn = IdentifiedObjects.toURN(crs.getClass(), id); - assertNotNull(crs.getName().getCode(), urn); + assertNotNull(urn, crs.getName().getCode()); /* * Lookup operation is not going to work if the CRS are not approximately equal. * However, in current Apache SIS implementation, we can perform this check only diff --git a/endorsed/src/org.apache.sis.storage.netcdf/test/org/apache/sis/storage/netcdf/base/VariableTest.java b/endorsed/src/org.apache.sis.storage.netcdf/test/org/apache/sis/storage/netcdf/base/VariableTest.java index bfa0926f2d..eac471d903 100644 --- a/endorsed/src/org.apache.sis.storage.netcdf/test/org/apache/sis/storage/netcdf/base/VariableTest.java +++ b/endorsed/src/org.apache.sis.storage.netcdf/test/org/apache/sis/storage/netcdf/base/VariableTest.java @@ -116,7 +116,7 @@ public class VariableTest extends TestCase { for (final Variable variable : variables) { final String name = variable.getName(); final DataType dataType = variable.getDataType(); - assertFalse(propertyIndex == expected.length); + assertNotEquals(propertyIndex, expected.length); assertEquals(expected[propertyIndex++], name, name); assertEquals(expected[propertyIndex++], variable.getDescription(), name); assertEquals(expected[propertyIndex++], dataType, name); diff --git a/endorsed/src/org.apache.sis.storage.xml/test/org/apache/sis/storage/gpx/TypesTest.java b/endorsed/src/org.apache.sis.storage.xml/test/org/apache/sis/storage/gpx/TypesTest.java index 6d49a98459..d721507ced 100644 --- a/endorsed/src/org.apache.sis.storage.xml/test/org/apache/sis/storage/gpx/TypesTest.java +++ b/endorsed/src/org.apache.sis.storage.xml/test/org/apache/sis/storage/gpx/TypesTest.java @@ -78,6 +78,6 @@ public final class TypesTest extends TestCase { */ private static void assertNonEmpty(final String name, final InternationalString i18n) { assertNotNull(i18n, name); - assertTrue(i18n.length() != 0, name); + assertNotEquals(i18n.length(), 0, name); } } diff --git a/endorsed/src/org.apache.sis.util/test/org/apache/sis/converter/NumberConverterTest.java b/endorsed/src/org.apache.sis.util/test/org/apache/sis/converter/NumberConverterTest.java index ffefe89dcf..d6106fa728 100644 --- a/endorsed/src/org.apache.sis.util/test/org/apache/sis/converter/NumberConverterTest.java +++ b/endorsed/src/org.apache.sis.util/test/org/apache/sis/converter/NumberConverterTest.java @@ -69,7 +69,7 @@ public final class NumberConverterTest extends TestCase { final ObjectConverter<S,T> c, final S source, final T target, final S inverse) throws UnconvertibleObjectException { - assertFalse(source.equals(inverse)); + assertNotEquals(source, inverse); assertEquals(target, c.apply(source), "Forward conversion."); assertEquals(inverse, c.inverse().apply(target), "Inverse conversion."); } diff --git a/endorsed/src/org.apache.sis.util/test/org/apache/sis/math/StatisticsTest.java b/endorsed/src/org.apache.sis.util/test/org/apache/sis/math/StatisticsTest.java index 85f0bb6c4a..b22c493749 100644 --- a/endorsed/src/org.apache.sis.util/test/org/apache/sis/math/StatisticsTest.java +++ b/endorsed/src/org.apache.sis.util/test/org/apache/sis/math/StatisticsTest.java @@ -233,7 +233,7 @@ public final class StatisticsTest extends TestCase { assertEquals(block, byBlock, "Adding for the first time; should have the same amount of data."); assertEquals(global, byBlock, "Adding for the first time; should have got exactly the same data."); } else { - assertFalse(byBlock.equals(block), "Should have more data that the block we just computed."); + assertNotEquals(byBlock, block, "Should have more data that the block we just computed."); } assertEquals(global.count(), byBlock.count()); assertEquals(global.countNaN(), byBlock.countNaN()); diff --git a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/LinearConverterTest.java b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/LinearConverterTest.java index e7fa4031fe..018dd4ca4d 100644 --- a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/LinearConverterTest.java +++ b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/LinearConverterTest.java @@ -212,9 +212,9 @@ public final class LinearConverterTest extends TestCase { assertFalse(c1.equals(c2)); assertTrue (c1.equals(c3)); assertFalse(c2.equals(c3)); - assertFalse(c1.hashCode() == c2.hashCode()); - assertTrue (c1.hashCode() == c3.hashCode()); - assertFalse(c2.hashCode() == c3.hashCode()); + assertNotEquals(c1.hashCode(), c2.hashCode()); + assertEquals (c1.hashCode(), c3.hashCode()); + assertNotEquals(c2.hashCode(), c3.hashCode()); } /** diff --git a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/QuantitiesTest.java b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/QuantitiesTest.java index 111902117f..ff1b9e935a 100644 --- a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/QuantitiesTest.java +++ b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/QuantitiesTest.java @@ -136,9 +136,9 @@ public final class QuantitiesTest extends TestCase { Quantity<?> q1 = Quantities.create(2, Units.VOLT); Quantity<?> q2 = Quantities.create(2, Units.VOLT); Quantity<?> q3 = Quantities.create(3, Units.VOLT); - assertTrue (q1.hashCode() == q2.hashCode()); - assertFalse(q1.hashCode() == q3.hashCode()); - assertTrue (q1.hashCode() != 0); + assertEquals (q1.hashCode(), q2.hashCode()); + assertNotEquals(q1.hashCode(), q3.hashCode()); + assertNotEquals(0, q1.hashCode()); assertTrue (q1.equals(q2)); assertFalse(q1.equals(q3)); } diff --git a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/CharactersTest.java b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/CharactersTest.java index ba1196a658..5c3279e86e 100644 --- a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/CharactersTest.java +++ b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/CharactersTest.java @@ -111,7 +111,7 @@ public final class CharactersTest extends TestCase { public void testSuperScript() { for (char c='0'; c<='9'; c++) { final char s = toSuperScript(c); - assertFalse(s == c); + assertNotEquals(s, c); assertFalse(isSuperScript(c)); assertTrue (isSuperScript(s)); assertEquals(c, toNormalScript(s)); @@ -129,7 +129,7 @@ public final class CharactersTest extends TestCase { public void testSubScript() { for (char c='0'; c<='9'; c++) { final char s = toSubScript(c); - assertFalse(s == c); + assertNotEquals(s, c); assertFalse(isSubScript(c)); assertTrue (isSubScript(s)); assertEquals(c, toNormalScript(s)); diff --git a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/UtilitiesTest.java b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/UtilitiesTest.java index 3dbc1b2e1d..59cf3c7805 100644 --- a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/UtilitiesTest.java +++ b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/UtilitiesTest.java @@ -83,9 +83,9 @@ public final class UtilitiesTest extends TestCase { assertTrue(c2.add(e3)); assertEquals(!orderIsSignificant, Utilities.deepEquals(c1, c2, mode)); - assertTrue(e1.comparisonCount != 0); - assertTrue(e2.comparisonCount != 0); - assertTrue(e3.comparisonCount != 0); + assertNotEquals(0, e1.comparisonCount); + assertNotEquals(0, e2.comparisonCount); + assertNotEquals(0, e3.comparisonCount); } /** diff --git a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/DefaultTreeTableTest.java b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/DefaultTreeTableTest.java index 598d57c674..fd52138f0e 100644 --- a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/DefaultTreeTableTest.java +++ b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/DefaultTreeTableTest.java @@ -153,7 +153,7 @@ public final class DefaultTreeTableTest extends TestCase { assertEquals(table, newTable); assertEquals(table.hashCode(), newTable.hashCode()); getChildrenList(newTable).get(1).setValue(NAME, "New name"); - assertFalse(newTable.equals(table)); + assertNotEquals(newTable, table); } /** @@ -168,7 +168,7 @@ public final class DefaultTreeTableTest extends TestCase { public static void testSerialization(final TreeTable table) { final TreeTable newTable = assertSerializedEquals(table); getChildrenList(newTable).get(1).setValue(NAME, "New name"); - assertFalse(newTable.equals(table)); + assertNotEquals(newTable, table); } /** diff --git a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/RangeSetTest.java b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/RangeSetTest.java index 9fabaf310c..196256e1a1 100644 --- a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/RangeSetTest.java +++ b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/collection/RangeSetTest.java @@ -556,7 +556,7 @@ public final class RangeSetTest extends TestCase { final RangeSet<Integer> clone = ranges.clone(); assertEquals(ranges, clone, "The clone shall be equal to the original set."); assertTrue(ranges.add(60, 70)); - assertFalse(ranges.equals(clone), "Modifying the original set shall not modify the clone."); + assertNotEquals(ranges, clone, "Modifying the original set shall not modify the clone."); } /** diff --git a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/internal/AbstractMapTest.java b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/internal/AbstractMapTest.java index 116ffb207c..e9175a4809 100644 --- a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/internal/AbstractMapTest.java +++ b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/internal/AbstractMapTest.java @@ -165,7 +165,7 @@ public final class AbstractMapTest extends TestCase { assertEquals("two", map.put(2, "deux")); assertFalse(copy.equals(map)); assertFalse(map.equals(copy)); - assertFalse(copy.hashCode() == map.hashCode()); + assertNotEquals(copy.hashCode(), map.hashCode()); } /** diff --git a/incubator/src/org.apache.sis.portrayal.map/test/org/apache/sis/map/service/GraphicsPortrayerTest.java b/incubator/src/org.apache.sis.portrayal.map/test/org/apache/sis/map/service/GraphicsPortrayerTest.java index b65b98e26d..283553bb72 100644 --- a/incubator/src/org.apache.sis.portrayal.map/test/org/apache/sis/map/service/GraphicsPortrayerTest.java +++ b/incubator/src/org.apache.sis.portrayal.map/test/org/apache/sis/map/service/GraphicsPortrayerTest.java @@ -99,8 +99,8 @@ public class GraphicsPortrayerTest { int color1 = image.getRGB(180, 45); int color2 = image.getRGB(179, 45); - assertTrue(color1 == Color.BLACK.getRGB()); - assertTrue(color2 == new Color(0,0,0,0).getRGB()); + assertEquals(color1, Color.BLACK.getRGB()); + assertEquals(color2, new Color(0,0,0,0).getRGB()); } /**