sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1576924 - in /sis/branches/JDK7/core: sis-metadata/src/main/java/org/apache/sis/io/wkt/ sis-referencing/src/main/java/org/apache/sis/parameter/ sis-referencing/src/main/java/org/apache/sis/referencing/ sis-referencing/src/main/java/org/apa...
Date Wed, 12 Mar 2014 21:28:30 GMT
Author: desruisseaux
Date: Wed Mar 12 21:28:29 2014
New Revision: 1576924

URL: http://svn.apache.org/r1576924
Log:
Provides a pseudo-WKT for parameter descriptors, for compliance with AbstractIdentifiedObject
contract.

Modified:
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/ElementKind.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/SubTypes.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/ElementKind.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/ElementKind.java?rev=1576924&r1=1576923&r2=1576924&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/ElementKind.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/ElementKind.java
[UTF-8] Wed Mar 12 21:28:29 2014
@@ -18,7 +18,9 @@ package org.apache.sis.io.wkt;
 
 import javax.measure.unit.Unit;
 import org.opengis.util.CodeList;
+import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Citation;
+import org.opengis.metadata.extent.Extent;
 import org.opengis.referencing.datum.Datum;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
 import org.opengis.referencing.operation.OperationMethod;
@@ -130,8 +132,10 @@ public enum ElementKind {
      *   <tr><td>{@link OperationMethod}</td>       <td>{@link #METHOD}</td></tr>
      *   <tr><td>{@link GeneralParameterValue}</td> <td>{@link #PARAMETER}</td></tr>
      *   <tr><td>{@link CoordinateSystemAxis}</td>  <td>{@link #AXIS}</td></tr>
+     *   <tr><td>{@link Identifier}</td>            <td>{@link #IDENTIFIER}</td></tr>
      *   <tr><td>{@link Citation}</td>              <td>{@link #CITATION}</td></tr>
      *   <tr><td>{@link CodeList}</td>              <td>{@link #CODE_LIST}</td></tr>
+     *   <tr><td>{@link Extent}</td>                <td>{@link #EXTENT}</td></tr>
      *   <tr><td>{@link Unit}</td>                  <td>{@link #UNIT}</td></tr>
      *   <tr><td>{@link Number}</td>                <td>{@link #INTEGER}
or {@link #NUMBER}</td></tr>
      * </table>
@@ -148,8 +152,10 @@ public enum ElementKind {
             if (OperationMethod      .class.isAssignableFrom(type)) return METHOD;
             if (GeneralParameterValue.class.isAssignableFrom(type)) return PARAMETER;
             if (CoordinateSystemAxis .class.isAssignableFrom(type)) return AXIS;
+            if (Identifier           .class.isAssignableFrom(type)) return IDENTIFIER;
             if (Citation             .class.isAssignableFrom(type)) return CITATION;
             if (CodeList             .class.isAssignableFrom(type)) return CODE_LIST;
+            if (Extent               .class.isAssignableFrom(type)) return EXTENT;
             if (Unit                 .class.isAssignableFrom(type)) return UNIT;
             if (Number.class.isAssignableFrom(type)) {
                 return Numbers.isInteger(type) ? INTEGER : NUMBER;

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java?rev=1576924&r1=1576923&r2=1576924&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
[UTF-8] Wed Mar 12 21:28:29 2014
@@ -1028,7 +1028,7 @@ public class Formatter implements Locali
      * formatted without the trailing ".0".
      */
     private void appendExact(final double number) {
-        if (Locale.ROOT.equals(locale)) {
+        if (Locale.ROOT.equals(symbols.getLocale())) {
             appendSeparator();
             setColor(highlightError ? ElementKind.ERROR : ElementKind.NUMBER);
             final int i = (int) number;
@@ -1239,9 +1239,9 @@ public class Formatter implements Locali
     }
 
     /**
-     * Returns the unit to use instead than the given one, or the given unit if there is
no replacement for it.
-     * This method searches for a unit specified by {@link #addContextualUnit(Unit)} which
-     * {@linkplain Unit#isCompatible(Unit) is compatible} with the given unit.
+     * Returns the unit to use instead than the given one, or {@code null} if there is no
replacement
+     * for {@code unit}. This method searches for a unit specified by {@link #addContextualUnit(Unit)}
+     * which {@linkplain Unit#isCompatible(Unit) is compatible} with the given unit.
      *
      * @param  <Q>  The quantity of the unit.
      * @param  unit The unit to replace by the contextual unit, or {@code null}.
@@ -1256,7 +1256,7 @@ public class Formatter implements Locali
                 return candidate;
             }
         }
-        return unit;
+        return null;
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java?rev=1576924&r1=1576923&r2=1576924&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java
[UTF-8] Wed Mar 12 21:28:29 2014
@@ -23,15 +23,17 @@ import javax.measure.unit.Unit;
 import org.opengis.util.CodeList;
 import org.opengis.parameter.ParameterValue;
 import org.opengis.parameter.ParameterDescriptor;
-import org.apache.sis.util.Debug;
 import org.apache.sis.util.Classes;
 import org.apache.sis.util.Numbers;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.io.wkt.Formatter;
+import org.apache.sis.io.wkt.ElementKind;
 import org.apache.sis.measure.Range;
 import org.apache.sis.measure.MeasurementRange;
 import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.internal.util.CollectionsExt;
+import org.apache.sis.internal.referencing.WKTUtilities;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
 
@@ -258,6 +260,8 @@ public class DefaultParameterDescriptor<
      * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p>
      *
      * @param descriptor The descriptor to shallow copy.
+     *
+     * @see #castOrCopy(ParameterDescriptor)
      */
     @SuppressWarnings("unchecked")
     protected DefaultParameterDescriptor(final ParameterDescriptor<T> descriptor) {
@@ -270,6 +274,22 @@ public class DefaultParameterDescriptor<
     }
 
     /**
+     * Returns a SIS parameter implementation with the same values than the given arbitrary
implementation.
+     * If the given object is {@code null}, then this method returns {@code null}.
+     * Otherwise if the given object is already a SIS implementation, then the given object
is returned unchanged.
+     * Otherwise a new SIS implementation is created and initialized to the values of the
given object.
+     *
+     * @param  <T> The type of values.
+     * @param  object The object to get as a SIS implementation, or {@code null} if none.
+     * @return A SIS implementation containing the values of the given object (may be the
+     *         given object itself), or {@code null} if the argument was null.
+     */
+    public static <T> DefaultParameterDescriptor<T> castOrCopy(final ParameterDescriptor<T>
object) {
+        return (object == null) || (object instanceof DefaultParameterDescriptor<?>)
+                ? (DefaultParameterDescriptor<T>) object : new DefaultParameterDescriptor<>(object);
+    }
+
+    /**
      * Returns the GeoAPI interface implemented by this class.
      * The SIS implementation returns {@code ParameterDescriptor.class}.
      *
@@ -509,24 +529,26 @@ public class DefaultParameterDescriptor<
     }
 
     /**
-     * Returns a string representation of this descriptor. The string returned by this
-     * method is for information purpose only and may change in future SIS version.
-     */
-    @Debug
-    @Override
-    public String toString() {
-        final StringBuilder buffer = new StringBuilder(Classes.getShortClassName(this))
-                .append("[\"").append(getName().getCode()).append("\", ")
-                .append(getMinimumOccurs() == 0 ? "optional" : "mandatory");
-        buffer.append(", class=").append(Classes.getShortName(valueClass));
-        if (valueDomain != null) {
-            buffer.append(", valid=").append(valueDomain);
-        } else if (validValues != null) {
-            buffer.append(", valid=").append(validValues);
-        }
-        if (defaultValue != null) {
-            buffer.append(", default=").append(defaultValue);
+     * Formats this parameter as a pseudo-<cite>Well Known Text</cite> element.
The WKT specification
+     * does not define any representation of parameter descriptors. Apache SIS fallback on
the
+     * {@linkplain DefaultParameterValue#formatTo(Formatter) same representation than parameter
value},
+     * with the descriptor {@linkplain #getDefaultValue() default value} in place of the
parameter value.
+     * The text formatted by this method is {@linkplain Formatter#setInvalidWKT flagged as
invalid WKT}.
+     *
+     * @param  formatter The formatter where to format the inner content of this WKT element.
+     * @return {@code "Parameter"}.
+     */
+    @Override
+    protected String formatTo(final Formatter formatter) {
+        WKTUtilities.appendName(this, formatter, ElementKind.PARAMETER);
+        formatter.setInvalidWKT(this, null);
+        formatter.appendAny(defaultValue);
+        final Unit<?> unit = getUnit();
+        if (unit != null) {
+            if (!formatter.getConvention().isSimplified() || !unit.equals(formatter.toContextualUnit(unit)))
{
+                formatter.append(unit);
+            }
         }
-        return buffer.append(']').toString();
+        return "Parameter";
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java?rev=1576924&r1=1576923&r2=1576924&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java
[UTF-8] Wed Mar 12 21:28:29 2014
@@ -22,6 +22,7 @@ import java.util.List;
 import java.util.HashSet;
 import java.util.Collections;
 import org.opengis.parameter.ParameterValueGroup;
+import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
 import org.opengis.parameter.GeneralParameterDescriptor;
 import org.opengis.parameter.ParameterNotFoundException;
@@ -29,6 +30,9 @@ import org.opengis.parameter.InvalidPara
 import org.apache.sis.referencing.AbstractIdentifiedObject;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.internal.util.UnmodifiableArrayList;
+import org.apache.sis.internal.referencing.WKTUtilities;
+import org.apache.sis.io.wkt.FormattableObject;
+import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.ComparisonMode;
@@ -185,6 +189,8 @@ public class DefaultParameterDescriptorG
      * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p>
      *
      * @param descriptor The descriptor to shallow copy.
+     *
+     * @see #castOrCopy(ParameterDescriptorGroup)
      */
     protected DefaultParameterDescriptorGroup(final ParameterDescriptorGroup descriptor)
{
         super(descriptor);
@@ -241,6 +247,21 @@ public class DefaultParameterDescriptorG
     }
 
     /**
+     * Returns a SIS group implementation with the same values than the given arbitrary implementation.
+     * If the given object is {@code null}, then this method returns {@code null}.
+     * Otherwise if the given object is already a SIS implementation, then the given object
is returned unchanged.
+     * Otherwise a new SIS implementation is created and initialized to the values of the
given object.
+     *
+     * @param  object The object to get as a SIS implementation, or {@code null} if none.
+     * @return A SIS implementation containing the values of the given object (may be the
+     *         given object itself), or {@code null} if the argument was null.
+     */
+    public static DefaultParameterDescriptorGroup castOrCopy(final ParameterDescriptorGroup
object) {
+        return (object == null) || (object instanceof DefaultParameterDescriptorGroup)
+                ? (DefaultParameterDescriptorGroup) object : new DefaultParameterDescriptorGroup(object);
+    }
+
+    /**
      * Returns the GeoAPI interface implemented by this class.
      * The SIS implementation returns {@code ParameterDescriptorGroup.class}.
      *
@@ -400,4 +421,33 @@ public class DefaultParameterDescriptorG
     public void print() {
         ParameterFormat.print(this);
     }
+
+    /**
+     * Formats this group as a pseudo-<cite>Well Known Text</cite> element. The
WKT specification
+     * does not define any representation of parameter descriptors. Apache SIS fallback on
a list
+     * of {@linkplain DefaultParameterDescriptor#formatTo(Formatter) single descriptors}.
+     * The text formatted by this method is {@linkplain Formatter#setInvalidWKT flagged as
invalid WKT}.
+     *
+     * @param  formatter The formatter where to format the inner content of this WKT element.
+     * @return {@code "ParameterGroup"}.
+     */
+    @Override
+    protected String formatTo(final Formatter formatter) {
+        WKTUtilities.appendName(this, formatter, null);
+        formatter.setInvalidWKT(this, null);
+        for (GeneralParameterDescriptor parameter : descriptors) {
+            if (!(parameter instanceof FormattableObject)) {
+                if (parameter instanceof ParameterDescriptor<?>) {
+                    parameter = new DefaultParameterDescriptor<>((ParameterDescriptor<?>)
parameter);
+                } else if (parameter instanceof ParameterDescriptorGroup) {
+                    parameter = new DefaultParameterDescriptorGroup((ParameterDescriptorGroup)
parameter);
+                } else {
+                    continue;
+                }
+            }
+            formatter.newLine();
+            formatter.append((FormattableObject) parameter);
+        }
+        return "ParameterGroup";
+    }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java?rev=1576924&r1=1576923&r2=1576924&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
[UTF-8] Wed Mar 12 21:28:29 2014
@@ -375,8 +375,10 @@ public class AbstractIdentifiedObject ex
      *       {@link org.opengis.referencing.cs.CoordinateSystem},
      *       {@link org.opengis.referencing.cs.CoordinateSystemAxis},
      *       {@link org.opengis.referencing.datum.Datum},
-     *       {@link org.opengis.referencing.datum.Ellipsoid} or
+     *       {@link org.opengis.referencing.datum.Ellipsoid},
      *       {@link org.opengis.referencing.datum.PrimeMeridian},
+     *       {@link org.opengis.parameter.ParameterDescriptor} or
+     *       {@link org.opengis.parameter.ParameterDescriptorGroup},
      *       then this method delegates to the {@code castOrCopy(…)} method of the corresponding
SIS subclass.
      *       Note that if the given object implements more than one of the above-cited interfaces,
      *       then the {@code castOrCopy(…)} method to be used is unspecified.</li>

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/SubTypes.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/SubTypes.java?rev=1576924&r1=1576923&r2=1576924&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/SubTypes.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/SubTypes.java
[UTF-8] Wed Mar 12 21:28:29 2014
@@ -23,12 +23,16 @@ import org.opengis.referencing.crs.Coord
 import org.opengis.referencing.datum.Datum;
 import org.opengis.referencing.datum.Ellipsoid;
 import org.opengis.referencing.datum.PrimeMeridian;
+import org.opengis.parameter.ParameterDescriptor;
+import org.opengis.parameter.ParameterDescriptorGroup;
 import org.apache.sis.referencing.crs.AbstractCRS;
 import org.apache.sis.referencing.cs.AbstractCS;
 import org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis;
 import org.apache.sis.referencing.datum.AbstractDatum;
 import org.apache.sis.referencing.datum.DefaultEllipsoid;
 import org.apache.sis.referencing.datum.DefaultPrimeMeridian;
+import org.apache.sis.parameter.DefaultParameterDescriptor;
+import org.apache.sis.parameter.DefaultParameterDescriptorGroup;
 
 
 /**
@@ -77,6 +81,12 @@ final class SubTypes {
         if (object instanceof PrimeMeridian) {
             return DefaultPrimeMeridian.castOrCopy((PrimeMeridian) object);
         }
+        if (object instanceof ParameterDescriptor<?>) {
+            return DefaultParameterDescriptor.castOrCopy((ParameterDescriptor<?>) object);
+        }
+        if (object instanceof ParameterDescriptorGroup) {
+            return DefaultParameterDescriptorGroup.castOrCopy((ParameterDescriptorGroup)
object);
+        }
         /*
          * Intentionally check for AbstractIdentifiedObject after the interfaces because
user may have defined his own
          * subclass implementing the interface. If we were checking for AbstractIdentifiedObject
before the interfaces,

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java?rev=1576924&r1=1576923&r2=1576924&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
[UTF-8] Wed Mar 12 21:28:29 2014
@@ -342,7 +342,10 @@ public class DefaultPrimeMeridian extend
         super.formatTo(formatter);
         final Convention convention = formatter.getConvention();
         final boolean isWKT1 = convention.majorVersion() == 1;
-        final Unit<Angle> targetUnit = formatter.toContextualUnit(NonSI.DEGREE_ANGLE);
+        Unit<Angle> targetUnit = formatter.toContextualUnit(NonSI.DEGREE_ANGLE);
+        if (targetUnit == null) {
+            targetUnit = NonSI.DEGREE_ANGLE;
+        }
         formatter.append(isWKT1 ? getGreenwichLongitude(targetUnit) : greenwichLongitude);
         if (isWKT1) {
             return "PrimeM";

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java?rev=1576924&r1=1576923&r2=1576924&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
[UTF-8] Wed Mar 12 21:28:29 2014
@@ -30,8 +30,8 @@ import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
-import static org.junit.Assert.*;
 import static org.opengis.test.Validators.*;
+import static org.apache.sis.test.MetadataAssert.*;
 
 
 /**
@@ -201,8 +201,6 @@ public final strictfp class DefaultParam
         assertEquals("minimum",      Double.valueOf( 4), descriptor.getMinimumValue());
         assertEquals("maximum",      Double.valueOf(20), descriptor.getMaximumValue());
         validate(descriptor);
-        assertEquals("DefaultParameterDescriptor[\"Length measure\", mandatory, class=Double,
" +
-                "valid=[4.0 … 20.0] m, default=12.0]", descriptor.toString());
     }
 
     /**
@@ -285,4 +283,15 @@ public final strictfp class DefaultParam
             assertEquals("Argument ‘valueDomain’ can not be an instance of ‘Range<Integer>’.",
e.getMessage());
         }
     }
+
+    /**
+     * Tests the WKT representation.
+     */
+    @Test
+    public void testWKT() {
+        final DefaultParameterDescriptor<Double> descriptor = create("Real number",
4, 8, 5, SI.METRE);
+        assertWktEquals("Parameter[“Integer param”, 5]", create("Integer param", 4, 8,
5));
+        assertWktEquals("Parameter[“Real number”, 5.0, LengthUnit[“metre”, 1]]",
descriptor);
+        assertEquals("Parameter[\"Real number\", 5.0, Unit[\"metre\", 1]]", descriptor.toString());
+    }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java?rev=1576924&r1=1576923&r2=1576924&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java
[UTF-8] Wed Mar 12 21:28:29 2014
@@ -31,7 +31,7 @@ import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
-import static org.apache.sis.test.Assert.*;
+import static org.apache.sis.test.MetadataAssert.*;
 import static org.opengis.test.Validators.*;
 import static java.util.Collections.singletonMap;
 import static org.opengis.referencing.IdentifiedObject.NAME_KEY;
@@ -356,6 +356,19 @@ public final strictfp class DefaultParam
     }
 
     /**
+     * Tests the WKT representation.
+     */
+    @Test
+    public void testWKT() {
+        assertWktEquals(
+                "ParameterGroup[“Test group”,\n" +
+                "  Parameter[“Mandatory 1”, 10],\n" +
+                "  Parameter[“Mandatory 2”, 10],\n" +
+                "  Parameter[“Optional 3”, 10],\n" +
+                "  Parameter[“Optional 4”, 10]]", descriptor);
+    }
+
+    /**
      * Tests {@link DefaultParameterValueGroup} serialization.
      */
     @Test



Mime
View raw message