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 73a63a5e81 Add JUnit extension on classes that do not inherit it from `org.apache.sis.test.TestCase`. 73a63a5e81 is described below commit 73a63a5e81897da6291d1a195a40546d37769d60 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Sun Feb 18 22:19:20 2024 +0100 Add JUnit extension on classes that do not inherit it from `org.apache.sis.test.TestCase`. --- .../sis/util/iso/DefaultNameFactoryTest.java | 3 +++ .../test/org/apache/sis/io/wkt/WKTParserTest.java | 3 +++ .../factory/GeodeticObjectFactoryTest.java | 3 +++ .../referencing/geoapi/AuthorityFactoryTest.java | 3 +++ .../geoapi/ParameterizedTransformTest.java | 3 +++ .../builder/LocalizationGridBuilderTest.java | 3 +++ .../projection/ConformalProjectionTest.java | 5 ++++- .../projection/NormalizedProjectionTest.java | 3 +++ .../operation/provider/GeographicOffsetsTest.java | 5 ++++- .../operation/transform/CartesianToPolarTest.java | 3 +++ .../transform/CartesianToSphericalTest.java | 3 +++ .../transform/CoordinateSystemTransformTest.java | 5 ++++- .../transform/LinearInterpolator1DTest.java | 3 +++ .../operation/transform/MathTransformTestCase.java | 5 ++++- .../operation/transform/PolarToCartesianTest.java | 3 +++ .../transform/ProjectiveTransformTest.java | 3 +++ .../transform/SphericalToCartesianTest.java | 3 +++ .../apache/sis/test/FailureDetailsReporter.java | 24 +++++++++++++--------- 18 files changed, 69 insertions(+), 14 deletions(-) diff --git a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/util/iso/DefaultNameFactoryTest.java b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/util/iso/DefaultNameFactoryTest.java index 7f13bea30c..9c69ef4fa7 100644 --- a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/util/iso/DefaultNameFactoryTest.java +++ b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/util/iso/DefaultNameFactoryTest.java @@ -22,6 +22,8 @@ import org.apache.sis.util.SimpleInternationalString; // 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 org.opengis.test.util.NameTest; @@ -31,6 +33,7 @@ import org.opengis.test.util.NameTest; * * @author Martin Desruisseaux (Geomatys) */ +@ExtendWith(FailureDetailsReporter.class) public final class DefaultNameFactoryTest extends NameTest { /** * Creates a new test suite using the singleton factory instance. diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/io/wkt/WKTParserTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/io/wkt/WKTParserTest.java index 50abeaa76b..e3712318bd 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/io/wkt/WKTParserTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/io/wkt/WKTParserTest.java @@ -27,6 +27,8 @@ import org.apache.sis.referencing.factory.GeodeticObjectFactory; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Disabled; import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.extension.ExtendWith; +import org.apache.sis.test.FailureDetailsReporter; import org.opengis.test.wkt.CRSParserTest; @@ -36,6 +38,7 @@ import org.opengis.test.wkt.CRSParserTest; * * @author Martin Desruisseaux (IRD, Geomatys) */ +@ExtendWith(FailureDetailsReporter.class) public final class WKTParserTest extends CRSParserTest { /** * Whether the test should replace the curly quotation marks “ and ” by the straight quotation mark ". diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/factory/GeodeticObjectFactoryTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/factory/GeodeticObjectFactoryTest.java index 5b51bdb735..cefae8aae2 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/factory/GeodeticObjectFactoryTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/factory/GeodeticObjectFactoryTest.java @@ -44,6 +44,8 @@ import org.apache.sis.measure.Units; // 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 org.opengis.test.referencing.ObjectFactoryTest; import static org.apache.sis.referencing.Assertions.assertWktEquals; import static org.apache.sis.test.Assertions.assertMessageContains; @@ -55,6 +57,7 @@ import static org.apache.sis.test.Assertions.assertMessageContains; * * @author Cédric Briançon (Geomatys) */ +@ExtendWith(FailureDetailsReporter.class) public final class GeodeticObjectFactoryTest extends ObjectFactoryTest { /** * Creates a new test suite using the singleton factory instance. diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/geoapi/AuthorityFactoryTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/geoapi/AuthorityFactoryTest.java index b9136e44c1..4942e3c371 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/geoapi/AuthorityFactoryTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/geoapi/AuthorityFactoryTest.java @@ -21,6 +21,8 @@ import org.apache.sis.referencing.CRS; // Test dependencies import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.extension.ExtendWith; +import org.apache.sis.test.FailureDetailsReporter; /** @@ -32,6 +34,7 @@ import org.junit.jupiter.api.Disabled; * @author Cédric Briançon (Geomatys) * @author Martin Desruisseaux (Geomatys) */ +@ExtendWith(FailureDetailsReporter.class) public final class AuthorityFactoryTest extends org.opengis.test.referencing.AuthorityFactoryTest { /** * Creates a new test suite using the singleton factory instance. diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/geoapi/ParameterizedTransformTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/geoapi/ParameterizedTransformTest.java index da1ff20c9a..05ff9a6d14 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/geoapi/ParameterizedTransformTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/geoapi/ParameterizedTransformTest.java @@ -26,6 +26,8 @@ import org.apache.sis.referencing.operation.transform.DefaultMathTransformFactor import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterEach; import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import org.junit.jupiter.api.extension.ExtendWith; +import org.apache.sis.test.FailureDetailsReporter; /** @@ -33,6 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertInstanceOf; * * @author Martin Desruisseaux (Geomatys) */ +@ExtendWith(FailureDetailsReporter.class) public final class ParameterizedTransformTest extends org.opengis.test.referencing.ParameterizedTransformTest { /** * Creates a new test suite using the singleton factory instance. diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/builder/LocalizationGridBuilderTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/builder/LocalizationGridBuilderTest.java index df70882eba..87ddb8b66f 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/builder/LocalizationGridBuilderTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/builder/LocalizationGridBuilderTest.java @@ -25,6 +25,8 @@ import org.apache.sis.geometry.Envelope2D; // 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 org.opengis.test.referencing.TransformTestCase; import static org.apache.sis.referencing.Assertions.assertEnvelopeEquals; import static org.apache.sis.test.TestCase.STRICT; @@ -35,6 +37,7 @@ import static org.apache.sis.test.TestCase.STRICT; * * @author Martin Desruisseaux (Geomatys) */ +@ExtendWith(FailureDetailsReporter.class) public final class LocalizationGridBuilderTest extends TransformTestCase { /** * Creates a new test case. diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/projection/ConformalProjectionTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/projection/ConformalProjectionTest.java index 097b09a0eb..bfb388c4c4 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/projection/ConformalProjectionTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/projection/ConformalProjectionTest.java @@ -27,8 +27,10 @@ import static org.apache.sis.referencing.operation.projection.NormalizedProjecti // Test dependencies import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; -import org.opengis.test.referencing.TransformTestCase; +import org.junit.jupiter.api.extension.ExtendWith; +import org.apache.sis.test.FailureDetailsReporter; import org.apache.sis.test.TestUtilities; +import org.opengis.test.referencing.TransformTestCase; /** @@ -36,6 +38,7 @@ import org.apache.sis.test.TestUtilities; * * @author Martin Desruisseaux (Geomatys) */ +@ExtendWith(FailureDetailsReporter.class) public final class ConformalProjectionTest extends TransformTestCase { /** * Natural logarithm of the pseudo-infinity as returned by Mercator formulas in the spherical diff --git 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 index dbac9c1bf9..4998b71c49 100644 --- 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,6 +22,8 @@ import static org.apache.sis.metadata.internal.ReferencingServices.NAUTICAL_MILE // 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; @@ -32,6 +34,7 @@ import org.opengis.test.referencing.TransformTestCase; * * @author Martin Desruisseaux (Geomatys) */ +@ExtendWith(FailureDetailsReporter.class) public final class NormalizedProjectionTest extends TransformTestCase { /** * Tolerance level for comparing floating point numbers. diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/provider/GeographicOffsetsTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/provider/GeographicOffsetsTest.java index 8aa596318e..98c6c0ad3c 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/provider/GeographicOffsetsTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/provider/GeographicOffsetsTest.java @@ -25,8 +25,10 @@ import org.apache.sis.measure.Units; // Test dependencies import org.junit.jupiter.api.Test; -import org.opengis.test.referencing.TransformTestCase; +import org.junit.jupiter.api.extension.ExtendWith; +import org.apache.sis.test.FailureDetailsReporter; import org.apache.sis.referencing.cs.HardCodedCS; +import org.opengis.test.referencing.TransformTestCase; /** @@ -34,6 +36,7 @@ import org.apache.sis.referencing.cs.HardCodedCS; * * @author Martin Desruisseaux (Geomatys) */ +@ExtendWith(FailureDetailsReporter.class) public final class GeographicOffsetsTest extends TransformTestCase { /** * Creates a new test case. diff --git 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 index d3b419421d..f44d234e7b 100644 --- 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,6 +21,8 @@ import org.opengis.referencing.operation.TransformException; // 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: @@ -32,6 +34,7 @@ import org.opengis.test.referencing.TransformTestCase; * * @author Martin Desruisseaux (Geomatys) */ +@ExtendWith(FailureDetailsReporter.class) public final class CartesianToPolarTest extends TransformTestCase { /** * Creates a new test case. diff --git 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 index 968ccbe47b..2688ab256a 100644 --- 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,6 +25,8 @@ import org.opengis.referencing.operation.TransformException; 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: @@ -36,6 +38,7 @@ import org.opengis.test.referencing.TransformTestCase; * * @author Martin Desruisseaux (Geomatys) */ +@ExtendWith(FailureDetailsReporter.class) public final class CartesianToSphericalTest extends TransformTestCase { /** * Creates a new test case. diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/CoordinateSystemTransformTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/CoordinateSystemTransformTest.java index d44adc9ded..8323fdd2f6 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/CoordinateSystemTransformTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/CoordinateSystemTransformTest.java @@ -34,8 +34,10 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import static org.junit.jupiter.api.Assertions.*; -import org.opengis.test.referencing.TransformTestCase; +import org.junit.jupiter.api.extension.ExtendWith; +import org.apache.sis.test.FailureDetailsReporter; import org.apache.sis.referencing.cs.HardCodedCS; +import org.opengis.test.referencing.TransformTestCase; /** @@ -43,6 +45,7 @@ import org.apache.sis.referencing.cs.HardCodedCS; * * @author Martin Desruisseaux (Geomatys) */ +@ExtendWith(FailureDetailsReporter.class) @TestInstance(TestInstance.Lifecycle.PER_CLASS) public final class CoordinateSystemTransformTest extends TransformTestCase { /** diff --git 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 index ea60d7654b..764a56551d 100644 --- 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,6 +24,8 @@ import org.opengis.referencing.operation.TransformException; // 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: @@ -36,6 +38,7 @@ import org.opengis.test.referencing.TransformTestCase; * @author Rémi Maréchal (Geomatys) * @author Martin Desruisseaux (Geomatys). */ +@ExtendWith(FailureDetailsReporter.class) public final class LinearInterpolator1DTest extends TransformTestCase { /** * The values of the <i>y=f(x)</i> function to test. diff --git 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 index 3579e088b0..b24182f1b4 100644 --- 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,9 +38,11 @@ import org.apache.sis.referencing.operation.matrix.MatrixTestCase; // 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.util.Factory; @@ -80,6 +82,7 @@ import org.opengis.test.referencing.TransformTestCase; * * @author Martin Desruisseaux (Geomatys) */ +@ExtendWith(FailureDetailsReporter.class) public abstract class MathTransformTestCase extends TransformTestCase { /** * The number of coordinates to use for stressing the math transform. We use a number that diff --git 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 index 17475c5ae9..f858d2b948 100644 --- 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,6 +22,8 @@ import org.opengis.referencing.operation.TransformException; // 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: @@ -33,6 +35,7 @@ import org.opengis.test.referencing.TransformTestCase; * * @author Martin Desruisseaux (Geomatys) */ +@ExtendWith(FailureDetailsReporter.class) public final class PolarToCartesianTest extends TransformTestCase { /** * Creates a new test case. diff --git 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 index 5018977a3b..167f12ade6 100644 --- 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 @@ -35,6 +35,8 @@ 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: @@ -52,6 +54,7 @@ import org.opengis.test.referencing.AffineTransformTest; * * @author Martin Desruisseaux (Geomatys) */ +@ExtendWith(FailureDetailsReporter.class) public class ProjectiveTransformTest extends AffineTransformTest { /** * A math transform factory which delegates instantiations to the enclosing test class. diff --git 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 index 72bdb59ec1..3aef1781ef 100644 --- 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,6 +26,8 @@ import org.opengis.referencing.operation.TransformException; 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: @@ -37,6 +39,7 @@ import org.opengis.test.referencing.TransformTestCase; * * @author Martin Desruisseaux (Geomatys) */ +@ExtendWith(FailureDetailsReporter.class) public final class SphericalToCartesianTest extends TransformTestCase { /** * Creates a new test case. diff --git a/endorsed/src/org.apache.sis.util/test/org/apache/sis/test/FailureDetailsReporter.java b/endorsed/src/org.apache.sis.util/test/org/apache/sis/test/FailureDetailsReporter.java index e4452c1820..f67b3a2eff 100644 --- a/endorsed/src/org.apache.sis.util/test/org/apache/sis/test/FailureDetailsReporter.java +++ b/endorsed/src/org.apache.sis.util/test/org/apache/sis/test/FailureDetailsReporter.java @@ -16,8 +16,9 @@ */ package org.apache.sis.test; -import java.io.PrintWriter; +import java.io.PrintStream; import java.io.IOException; +import java.io.UncheckedIOException; import org.junit.jupiter.api.extension.AfterAllCallback; import org.junit.jupiter.api.extension.AfterEachCallback; import org.junit.jupiter.api.extension.BeforeEachCallback; @@ -59,27 +60,29 @@ public final class FailureDetailsReporter implements BeforeEachCallback, AfterEa */ @Override public final void afterEach(final ExtensionContext description) { - if (TestCase.VERBOSE) { - TestCase.flushOutput(); - } + boolean flush = TestCase.VERBOSE; LogRecordCollector.INSTANCE.setCurrentTest(null); if (description.getExecutionException().isPresent()) { - description.getTestMethod().ifPresent((methodName) -> { + description.getTestMethod().ifPresent((method) -> { final Long seed = TestUtilities.randomSeed.get(); if (seed != null) { - final PrintWriter out = TestCase.out; + @SuppressWarnings("UseOfSystemOutOrSystemErr") + final PrintStream out = System.err; // Same as logging console handler. out.print("Random number generator for "); out.print(description.getTestClass().map(Class::getCanonicalName).orElse("<?>")); out.print('.'); - out.print(methodName); + out.print(method.getName()); out.print("() was created with seed "); out.print(seed); out.println('.'); } - TestCase.flushOutput(); }); + flush = true; } TestUtilities.randomSeed.remove(); + if (flush) { + TestCase.flushOutput(); + } } /** @@ -89,11 +92,12 @@ public final class FailureDetailsReporter implements BeforeEachCallback, AfterEa * @param description description of the test container. */ @Override + @SuppressWarnings("UseOfSystemOutOrSystemErr") public final void afterAll(final ExtensionContext description) { try { - LogRecordCollector.INSTANCE.report(TestCase.out); + LogRecordCollector.INSTANCE.report(System.err); // Same stream as logging console handler. } catch (IOException e) { - throw new AssertionError(e); // Should never happen. + throw new UncheckedIOException(e); // Should never happen. } TestCase.flushOutput(); }