sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 03/04: Fix or avoid test failures happening on Windows.
Date Tue, 04 Jun 2019 16:21:29 GMT
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 3b1e96d90c14fa26f8e124dea4748fb6b76a45a8
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Tue Jun 4 17:49:48 2019 +0200

    Fix or avoid test failures happening on Windows.
---
 .../src/test/java/org/apache/sis/console/AboutCommandTest.java    | 8 +++-----
 .../src/test/java/org/apache/sis/console/CRSCommandTest.java      | 7 +++++--
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/application/sis-console/src/test/java/org/apache/sis/console/AboutCommandTest.java
b/application/sis-console/src/test/java/org/apache/sis/console/AboutCommandTest.java
index 2678390..0c7ff18 100644
--- a/application/sis-console/src/test/java/org/apache/sis/console/AboutCommandTest.java
+++ b/application/sis-console/src/test/java/org/apache/sis/console/AboutCommandTest.java
@@ -80,6 +80,8 @@ public final strictfp class AboutCommandTest extends TestCase {
 
     /**
      * Tests the sub-command with the {@code --verbose} option.
+     * Current implementation performs the same test than {@link #testDefault()}.
+     * We do not check the extra information because they depend on the environment.
      *
      * @throws Exception should never happen.
      */
@@ -87,11 +89,7 @@ public final strictfp class AboutCommandTest extends TestCase {
     public void testVerbose() throws Exception {
         final AboutCommand test = new AboutCommand(0, CommandRunner.TEST, "--verbose");
         test.run();
-        final String result = test.outputBuffer.toString();
-        verify(result);
-
-        // Check for a dependency which should be present.
-        assertTrue("geoapi", result.contains("geoapi"));
+        verify(test.outputBuffer.toString());
     }
 
     /**
diff --git a/application/sis-console/src/test/java/org/apache/sis/console/CRSCommandTest.java
b/application/sis-console/src/test/java/org/apache/sis/console/CRSCommandTest.java
index 242e96d..5c3aab9 100644
--- a/application/sis-console/src/test/java/org/apache/sis/console/CRSCommandTest.java
+++ b/application/sis-console/src/test/java/org/apache/sis/console/CRSCommandTest.java
@@ -36,8 +36,10 @@ import static org.junit.Assert.*;
 public final strictfp class CRSCommandTest extends TestCase {
     /**
      * The Well Known Text for EPSG:4326 as a regular expression.
+     * This string uses the native line separator. Consequently test cases comparing
+     * against this pattern are expected to use that line separator for every lines.
      */
-    private static final String WGS84 =
+    private final String WGS84 =
             "\\QGeodeticCRS[\"WGS 84\",\n" +
             "  Datum[\"World Geodetic System 1984\",\n" +
             "    Ellipsoid[\"WGS 84\", 6378137.0, 298.257223563]],\n" +
@@ -48,7 +50,8 @@ public final strictfp class CRSCommandTest extends TestCase {
             "  Scope[\"Horizontal component of 3D system.\\E.*\\Q\"],\n" +              
       // EPSG geodetic dataset provides more details here.
             "  Area[\"\\E.*\\Q\"],\n" +                                                 
       // Language may vary because of SIS localization.
             "  BBox[-90.00, -180.00, 90.00, 180.00],\n" +
-            "  Id[\"EPSG\", 4326,\\E.*\\Q URI[\"urn:ogc:def:crs:EPSG:\\E.*\\Q:4326\"]]]\n\\E";
 // Version number of EPSG dataset may vary.
+            "  Id[\"EPSG\", 4326,\\E.*\\Q URI[\"urn:ogc:def:crs:EPSG:\\E.*\\Q:4326\"]]]\n\\E"
  // Version number of EPSG dataset may vary.
+            .replace("\n", System.lineSeparator());
 
     /**
      * Tests fetching the CRS from a simple code ({@code "EPSG:4326"}).


Mime
View raw message