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 2015/09/01 10:19:56 UTC

svn commit: r1700417 - /sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java

Author: desruisseaux
Date: Tue Sep  1 08:19:56 2015
New Revision: 1700417

URL: http://svn.apache.org/r1700417
Log:
Fix incomplete tests: missing 'Assert.fail' statement if the expected exception wasn't thrown.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java?rev=1700417&r1=1700416&r2=1700417&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java [UTF-8] Tue Sep  1 08:19:56 2015
@@ -84,7 +84,7 @@ public final strictfp class DefaultParam
             final int minimumValue, final int maximumValue, final int defaultValue)
     {
         return new DefaultParameterDescriptor<>(properties(name), 1, 1, Integer.class,
-                NumberRange.create(minimumValue, true, maximumValue, true), null, Integer.valueOf(defaultValue));
+                NumberRange.create(minimumValue, true, maximumValue, true), null, defaultValue);
     }
 
     /**
@@ -102,7 +102,7 @@ public final strictfp class DefaultParam
     {
         return new DefaultParameterDescriptor<>(properties(name), 1, 1, Double.class,
                 MeasurementRange.create(minimumValue, true, maximumValue, true, unit), null,
-                Double.isNaN(defaultValue) ? null : Double.valueOf(defaultValue));
+                Double.isNaN(defaultValue) ? null : defaultValue);
     }
 
     /**
@@ -173,6 +173,7 @@ public final strictfp class DefaultParam
      */
     @Test
     @DependsOnMethod("testOptionalInteger")
+    @SuppressWarnings("UnnecessaryBoxing")
     public void testRangeValidation() {
         try {
             create("Test range", 20, 4, 12);
@@ -209,6 +210,7 @@ public final strictfp class DefaultParam
      * Tests {@code DefaultParameterDescriptor} construction for {@link Double} type.
      */
     @Test
+    @SuppressWarnings("UnnecessaryBoxing")
     public void testDoubleType() {
         final ParameterDescriptor<Double> descriptor = create("Length measure", 4, 20, 12, SI.METRE);
         assertEquals("name",         "Length measure",   descriptor.getName().getCode());
@@ -262,7 +264,8 @@ public final strictfp class DefaultParam
          * Invalid operation: element not in the list of valid elements.
          */
         try {
-            create("Enumeration param", String.class, enumeration, "Pear");
+            DefaultParameterDescriptor<String> p = create("Enumeration param", String.class, enumeration, "Pear");
+            fail("Should not be allowed to create " + p);
         } catch (IllegalArgumentException e) {
             assertEquals("Parameter “Enumeration param” can not take the “Pear” value.", e.getMessage());
         }
@@ -273,6 +276,7 @@ public final strictfp class DefaultParam
      */
     @Test
     @DependsOnMethod("testDoubleType")
+    @SuppressWarnings("UnnecessaryBoxing")
     public void testArrayType() {
         final DefaultParameterDescriptor<double[]> descriptor = createForArray("Array param", 4, 9, SI.METRE);
         assertEquals("name",       "Array param",  descriptor.getName().getCode());
@@ -294,8 +298,9 @@ public final strictfp class DefaultParam
          * Invalid operation: wrong type of range value.
          */
         try {
-            new DefaultParameterDescriptor<>(properties("Array param"), 0, 1,
-                    double[].class, NumberRange.create(4, true, 9, true), null, null);
+            DefaultParameterDescriptor<double[]> p = new DefaultParameterDescriptor<>(properties("Array param"),
+                    0, 1, double[].class, NumberRange.create(4, true, 9, true), null, null);
+            fail("Should not be allowed to create " + p);
         } catch (IllegalArgumentException e) {
             assertEquals("Argument ‘valueDomain’ can not be an instance of ‘Range<Integer>’.", e.getMessage());
         }