You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2020/06/26 18:08:25 UTC
[sis] branch geoapi-4.0 updated: Add more tests.
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 e2eea52 Add more tests.
e2eea52 is described below
commit e2eea527efbbabc83da153637f84ec56046b7f96
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Jun 26 19:30:36 2020 +0200
Add more tests.
---
.../java/org/apache/sis/geometry/CoordinateFormatTest.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/geometry/CoordinateFormatTest.java b/core/sis-referencing/src/test/java/org/apache/sis/geometry/CoordinateFormatTest.java
index d101cfb..e054553 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/geometry/CoordinateFormatTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/geometry/CoordinateFormatTest.java
@@ -51,6 +51,14 @@ import static org.junit.Assert.*;
*/
public final strictfp class CoordinateFormatTest extends TestCase {
/**
+ * Compares coordinate values from the given positions.
+ */
+ private static void assertPositionEquals(final DirectPosition expected, final DirectPosition actual) {
+ assertNotSame(expected, actual);
+ assertArrayEquals(expected.getCoordinate(), actual.getCoordinate(), STRICT);
+ }
+
+ /**
* Tests formatting a coordinate in unknown CRS.
* The coordinate values are expected to be formatted as ordinary numbers.
*/
@@ -353,13 +361,15 @@ public final strictfp class CoordinateFormatTest extends TestCase {
*/
format.setPrecisions(1000, 2000);
assertEquals("400 km E 600 km S", format.format(pos));
- assertArrayEquals(pos.getCoordinate(), format.parseObject("400 km E 600 km S").getCoordinate(), STRICT);
+ assertPositionEquals(pos, format.parseObject("400 km E 600 km S"));
+ assertPositionEquals(pos, format.parseObject("400,000 m E 600,000 m S"));
/*
* Test reverting back to unscaled units.
*/
format.setPrecisions(100, 200);
assertEquals("400,000 m E 600,000 m S", format.format(pos));
- assertArrayEquals(pos.getCoordinate(), format.parseObject("400,000 m E 600,000 m S").getCoordinate(), STRICT);
+ assertPositionEquals(pos, format.parseObject("400,000 m E 600,000 m S"));
+ assertPositionEquals(pos, format.parseObject("400 km E 600 km S"));
}
/**