sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 01/02: Add test for the case where a SampleDimension has only qualitative categories.
Date Thu, 24 Jan 2019 16:00:01 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 08b145234b97d02b037760830725a829a45535f7
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Thu Jan 24 15:58:24 2019 +0100

    Add test for the case where a SampleDimension has only qualitative categories.
---
 .../org/apache/sis/coverage/SampleDimensionTest.java | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/core/sis-raster/src/test/java/org/apache/sis/coverage/SampleDimensionTest.java
b/core/sis-raster/src/test/java/org/apache/sis/coverage/SampleDimensionTest.java
index 17a24d9..e8cbe07 100644
--- a/core/sis-raster/src/test/java/org/apache/sis/coverage/SampleDimensionTest.java
+++ b/core/sis-raster/src/test/java/org/apache/sis/coverage/SampleDimensionTest.java
@@ -39,6 +39,26 @@ import static org.opengis.test.Assert.*;
  */
 public final strictfp class SampleDimensionTest extends TestCase {
     /**
+     * Tests a sample dimension having only qualitative categories.
+     */
+    @Test
+    public void testQualitative() {
+        final SampleDimension dimension = new SampleDimension.Builder()
+                .addQualitative("Clouds",    1)
+                .addQualitative("Lands",     2)
+                .addQualitative("Missing", 255)
+                .setName("Some data").build();
+
+        assertEquals("name", "Some data",  String.valueOf(dimension.getName()));
+        assertTrue  ("nodataValues",       dimension.getNoDataValues().isEmpty());
+        assertFalse ("background",         dimension.getBackground().isPresent());
+        assertFalse ("transferFunction",   dimension.getTransferFunction().isPresent());
+        assertFalse ("units",              dimension.getUnits().isPresent());
+        assertSame  ("forConvertedValues", dimension, dimension.forConvertedValues(false));
+        assertSame  ("forConvertedValues", dimension, dimension.forConvertedValues(true));
+    }
+
+    /**
      * Tests a sample dimension having one quantitative category and a few "no data" values.
      */
     @Test


Mime
View raw message