sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1554601 - in /sis/branches/JDK7: core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/ core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/quality/ core/sis-referencing/src/main/java/org/apache/sis/referencing/ core/...
Date Wed, 01 Jan 2014 05:25:02 GMT
Author: desruisseaux
Date: Wed Jan  1 05:25:02 2014
New Revision: 1554601

URL: http://svn.apache.org/r1554601
Log:
Consolidate XML tests and first draft of an DefaultEllipsoidalCS test.

Added:
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCSTest.java
  (with props)
    sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/cs/
    sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/cs/EllipsoidalCS.xml
  (with props)
Removed:
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DatumTestCase.java
Modified:
    sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStepTest.java
    sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/quality/AbstractPositionalAccuracyTest.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/cs/AbstractCS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectVerifier.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java
    sis/branches/JDK7/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java

Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStepTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStepTest.java?rev=1554601&r1=1554600&r2=1554601&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStepTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStepTest.java
[UTF-8] Wed Jan  1 05:25:02 2014
@@ -16,14 +16,12 @@
  */
 package org.apache.sis.metadata.iso.lineage;
 
-import java.net.URL;
-import java.io.IOException;
 import javax.xml.bind.JAXBException;
 import org.apache.sis.util.iso.SimpleInternationalString;
 import org.apache.sis.test.XMLTestCase;
 import org.junit.Test;
 
-import static org.apache.sis.test.Assert.*;
+import static org.junit.Assert.*;
 
 
 /**
@@ -37,16 +35,9 @@ import static org.apache.sis.test.Assert
  */
 public final strictfp class DefaultProcessStepTest extends XMLTestCase {
     /**
-     * Returns the URL to the XML file of the given name.
-     *
-     * @param  filename The name of the XML file.
-     * @return The URL to the given XML file.
+     * An XML file in this package containing a process step definition.
      */
-    private static URL getResource(final String filename) {
-        final URL resource = DefaultProcessStepTest.class.getResource(filename);
-        assertNotNull(filename, resource);
-        return resource;
-    }
+    private static final String XML_FILE = "ProcessStep.xml";
 
     /**
      * Tests the (un)marshalling of a metadata mixing elements from ISO 19115 and ISO 19115-2
standards.
@@ -54,11 +45,10 @@ public final strictfp class DefaultProce
      * <p><b>XML test file:</b>
      * <a href="{@scmUrl metadata}/lineage/ProcessStep.xml">ProcessStep.xml</a></p>
      *
-     * @throws IOException   If an error occurred while reading the XML file.
      * @throws JAXBException If an error occurred during the during marshalling / unmarshalling
processes.
      */
     @Test
-    public void testXML() throws IOException, JAXBException {
+    public void testXML() throws JAXBException {
         final DefaultProcessing  processing  = new DefaultProcessing();
         final DefaultProcessStep processStep = new DefaultProcessStep("Some process step.");
         processing.setProcedureDescription(new SimpleInternationalString("Some procedure."));
@@ -66,12 +56,10 @@ public final strictfp class DefaultProce
         /*
          * XML marshalling, and compare with the content of "ProcessStep.xml" file.
          */
-        final String xml = marshal(processStep);
-        assertTrue(xml.startsWith("<?xml"));
-        assertXmlEquals(getResource("ProcessStep.xml"), xml, "xmlns:*", "xsi:schemaLocation");
+        assertMarshalEqualsFile(XML_FILE, processStep, "xlmns:*", "xsi:schemaLocation");
         /*
-         * Final comparison: ensure that we didn't lost any information.
+         * XML unmarshalling: ensure that we didn't lost any information.
          */
-        assertEquals(processStep, unmarshal(DefaultProcessStep.class, xml));
+        assertEquals(processStep, unmarshalFile(DefaultProcessStep.class, XML_FILE));
     }
 }

Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/quality/AbstractPositionalAccuracyTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/quality/AbstractPositionalAccuracyTest.java?rev=1554601&r1=1554600&r2=1554601&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/quality/AbstractPositionalAccuracyTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/quality/AbstractPositionalAccuracyTest.java
[UTF-8] Wed Jan  1 05:25:02 2014
@@ -17,17 +17,14 @@
 package org.apache.sis.metadata.iso.quality;
 
 import java.util.Locale;
-import java.net.URL;
-import java.io.IOException;
 import javax.xml.bind.JAXBException;
 import org.opengis.util.InternationalString;
-import org.apache.sis.xml.XML;
 import org.apache.sis.xml.FreeTextMarshallingTest;
 import org.apache.sis.test.XMLTestCase;
 import org.apache.sis.test.DependsOn;
 import org.junit.Test;
 
-import static org.apache.sis.test.Assert.*;
+import static org.opengis.test.Assert.*;
 import static org.apache.sis.test.TestUtilities.getSingleton;
 
 
@@ -43,16 +40,9 @@ import static org.apache.sis.test.TestUt
 @DependsOn(FreeTextMarshallingTest.class)
 public final strictfp class AbstractPositionalAccuracyTest extends XMLTestCase {
     /**
-     * Returns the URL to the XML file of the given name.
-     *
-     * @param  filename The name of the XML file.
-     * @return The URL to the given XML file.
+     * An XML file in this package containing a positional accuracy definition.
      */
-    private static URL getResource(final String filename) {
-        final URL resource = AbstractPositionalAccuracyTest.class.getResource(filename);
-        assertNotNull(filename, resource);
-        return resource;
-    }
+    private static final String XML_FILE = "PositionalAccuracy.xml";
 
     /**
      * Tests the (un)marshalling of a text group with a default {@code <gco:CharacterString>}
element.
@@ -62,18 +52,15 @@ public final strictfp class AbstractPosi
      * <p><b>XML test file:</b>
      * <a href="{@scmUrl metadata}/quality/PositionalAccuracy.xml">PositionalAccuracy.xml</a></p>
      *
-     * @throws IOException   If an error occurred while reading the XML file.
      * @throws JAXBException If an error occurred during the during marshalling / unmarshalling
processes.
      *
      * @see <a href="http://jira.geotoolkit.org/browse/GEOTK-107">GEOTK-107</a>
      * @see FreeTextMarshallingTest
      */
     @Test
-    public void testXML() throws IOException, JAXBException {
-        final URL    resource = getResource("PositionalAccuracy.xml");
-        final Object metadata = XML.unmarshal(resource);
-        assertInstanceOf("PositionalAccuracy.xml", AbstractElement.class, metadata);
-        final InternationalString nameOfMeasure = getSingleton(((AbstractElement) metadata).getNamesOfMeasure());
+    public void testXML() throws JAXBException {
+        final AbstractElement metadata = unmarshalFile(AbstractElement.class, XML_FILE);
+        final InternationalString nameOfMeasure = getSingleton(metadata.getNamesOfMeasure());
         /*
          * Programmatic verification of the text group.
          */
@@ -86,10 +73,10 @@ public final strictfp class AbstractPosi
          * needs to contain a "result" element in order to pass XML validation test.
          */
         assertInstanceOf("Wrong value for <gmd:result>", DefaultConformanceResult.class,
-                getSingleton(((AbstractElement) metadata).getResults()));
+                getSingleton(metadata.getResults()));
         /*
-         * Final comparison: ensure that we didn't lost any information.
+         * Marshalling: ensure that we didn't lost any information.
          */
-        assertXmlEquals(resource, marshal(metadata), "xmlns:*", "xsi:schemaLocation", "xsi:type");
+        assertMarshalEqualsFile(XML_FILE, metadata, "xmlns:*", "xsi:schemaLocation", "xsi:type");
     }
 }

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=1554601&r1=1554600&r2=1554601&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 Jan  1 05:25:02 2014
@@ -120,7 +120,8 @@ import java.util.Objects;
     AbstractReferenceSystem.class,
     org.apache.sis.referencing.datum.AbstractDatum.class,
     org.apache.sis.referencing.datum.DefaultEllipsoid.class,
-    org.apache.sis.referencing.datum.DefaultPrimeMeridian.class
+    org.apache.sis.referencing.datum.DefaultPrimeMeridian.class,
+    org.apache.sis.referencing.cs.AbstractCS.class
 })
 public class AbstractIdentifiedObject extends FormattableObject implements IdentifiedObject,
         LenientComparable, Deprecable, Serializable

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java?rev=1554601&r1=1554600&r2=1554601&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
[UTF-8] Wed Jan  1 05:25:02 2014
@@ -21,7 +21,9 @@ import java.util.Arrays;
 import javax.measure.unit.SI;
 import javax.measure.unit.Unit;
 import javax.measure.unit.NonSI;
+import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlSeeAlso;
 import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
 import org.opengis.referencing.ReferenceIdentifier;
@@ -65,6 +67,10 @@ import static org.apache.sis.util.Utilit
  * @see DefaultCoordinateSystemAxis
  * @see org.apache.sis.referencing.crs.AbstractCRS
  */
+@XmlType(name = "AbstractCoordinateSystemType")
+@XmlSeeAlso({
+    DefaultEllipsoidalCS.class
+})
 public class AbstractCS extends AbstractIdentifiedObject implements CoordinateSystem {
     /**
      * Serial number for inter-operability with different versions.

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java?rev=1554601&r1=1554600&r2=1554601&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
[UTF-8] Wed Jan  1 05:25:02 2014
@@ -143,12 +143,12 @@ public class DefaultCoordinateSystemAxis
     private final Unit<?> unit;
 
     /**
-     * Minimal and maximal value for this axis.
+     * Minimal and maximal value for this axis, or negative/positive infinity if none.
      */
     private final double minimum, maximum;
 
     /**
-     * The range meaning for this axis.
+     * The range meaning for this axis, or {@code null} if unspecified.
      */
     private final RangeMeaning rangeMeaning;
 
@@ -227,7 +227,6 @@ public class DefaultCoordinateSystemAxis
         ensureNonNull("abbreviation", abbreviation);
         ensureNonNull("direction",    direction);
         ensureNonNull("unit",         unit);
-        ensureNonNull("rangeMeaning", rangeMeaning);
         if (!(minimum < maximum)) { // Use '!' for catching NaN
             throw new IllegalArgumentException(Errors.format(Errors.Keys.IllegalRange_2,
minimum, maximum));
         }
@@ -387,7 +386,7 @@ public class DefaultCoordinateSystemAxis
      * Returns the meaning of axis value range specified by the {@linkplain #getMinimumValue()
minimum}
      * and {@linkplain #getMaximumValue() maximum} values.
      *
-     * @return The meaning of axis value range.
+     * @return The meaning of axis value range, or {@code null} if unspecified.
      */
     @Override
     public RangeMeaning getRangeMeaning() {

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java?rev=1554601&r1=1554600&r2=1554601&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java
[UTF-8] Wed Jan  1 05:25:02 2014
@@ -18,6 +18,8 @@ package org.apache.sis.referencing.cs;
 
 import java.util.Map;
 import javax.measure.unit.Unit;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlRootElement;
 import org.opengis.referencing.cs.EllipsoidalCS;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
@@ -51,6 +53,8 @@ import org.apache.sis.measure.Units;
  * @version 0.4
  * @module
  */
+@XmlType(name = "EllipsoidalCSType")
+@XmlRootElement(name = "EllipsoidalCS")
 public class DefaultEllipsoidalCS extends AbstractCS implements EllipsoidalCS {
     /**
      * Serial number for inter-operability with different versions.

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java?rev=1554601&r1=1554600&r2=1554601&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
[UTF-8] Wed Jan  1 05:25:02 2014
@@ -66,7 +66,7 @@ import java.util.Objects;
  * @see org.apache.sis.referencing.cs.AbstractCS
  * @see org.apache.sis.referencing.crs.AbstractCRS
  */
-@XmlType(name="AbstractDatumType")
+@XmlType(name = "AbstractDatumType")
 @XmlSeeAlso({
     DefaultGeodeticDatum.class,
     DefaultVerticalDatum.class

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectVerifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectVerifier.java?rev=1554601&r1=1554600&r2=1554601&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectVerifier.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectVerifier.java
[UTF-8] Wed Jan  1 05:25:02 2014
@@ -26,6 +26,9 @@ import org.opengis.referencing.datum.Ell
 import org.opengis.referencing.datum.PrimeMeridian;
 import org.opengis.referencing.datum.GeodeticDatum;
 import org.opengis.referencing.datum.VerticalDatum;
+import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.opengis.referencing.cs.EllipsoidalCS;
+import org.opengis.referencing.cs.AxisDirection;
 
 import static org.apache.sis.test.Assert.*;
 
@@ -216,4 +219,32 @@ public final strictfp class GeodeticObje
         assertEquals("name", "Mean Sea Level", datum.getName().getCode());
         assertIsWorld(datum.getDomainOfValidity());
     }
+
+    /**
+     * Asserts that the given coordinate system contains the geodetic (latitude, longitude)
axes.
+     * This method verifies the following properties:
+     *
+     * <table class="sis">
+     * <tr><th>Property</th> <th>Expected value</th></tr>
+     * <tr><td>{@linkplain EllipsoidalCS#getDimension() Dimension}</td>
+     *     <td>2</td></tr>
+     * <tr><td>Axis names</td>
+     *     <td>{@code "Geodetic latitude"}, {@code "Geodetic longitude"}</td></tr>
+     * <tr><td>Axis directions</td>
+     *     <td>{@link AxisDirection#NORTH NORTH}, {@link AxisDirection#EAST EAST}</td></tr>
+     * </table>
+     *
+     * @param cs The coordinate system to verify.
+     */
+    public static void assertIsGeodetic2D(final EllipsoidalCS cs) {
+        assertEquals("dimension", 2, cs.getDimension());
+        final CoordinateSystemAxis latitude  = cs.getAxis(0);
+        final CoordinateSystemAxis longitude = cs.getAxis(1);
+        assertNotNull("axis", latitude);
+        assertNotNull("axis", longitude);
+        assertEquals("axis.name", "Geodetic latitude",  latitude .getName().getCode());
+        assertEquals("axis.name", "Geodetic longitude", longitude.getName().getCode());
+        assertEquals("axis.direction", AxisDirection.NORTH, latitude.getDirection());
+        assertEquals("axis.direction", AxisDirection.EAST, longitude.getDirection());
+    }
 }

Added: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCSTest.java?rev=1554601&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCSTest.java
(added)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCSTest.java
[UTF-8] Wed Jan  1 05:25:02 2014
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.referencing.cs;
+
+import javax.xml.bind.JAXBException;
+import org.opengis.test.Validators;
+import org.apache.sis.test.XMLTestCase;
+import org.apache.sis.test.DependsOn;
+import org.apache.sis.referencing.GeodeticObjectVerifier;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+
+/**
+ * Tests the {@link DefaultEllipsoidalCS} class.
+ *
+ * @author  Martin Desruisseaux (IRD)
+ * @since   0.4 (derived from geotk-2.2)
+ * @version 0.4
+ * @module
+ */
+@DependsOn(DefaultCoordinateSystemAxisTest.class)
+public final strictfp class DefaultEllipsoidalCSTest extends XMLTestCase {
+    /**
+     * An XML file in this package containing an ellipsoidal coordinate system definition.
+     */
+    private static final String XML_FILE = "EllipsoidalCS.xml";
+
+    /**
+     * Tests unmarshalling of an ellipsoidal coordinate system.
+     *
+     * @throws JAXBException If an error occurred during unmarshalling.
+     */
+    @Test
+    public void testUnmarshalling() throws JAXBException {
+        final DefaultEllipsoidalCS cs = unmarshalFile(DefaultEllipsoidalCS.class, XML_FILE);
+        Validators.validate(cs);
+        GeodeticObjectVerifier.assertIsGeodetic2D(cs);
+        /*
+         * Values in the following tests are specific to our XML file.
+         * The actual texts in the EPSG database are more descriptive.
+         */
+        assertEquals("name",    "Latitude (north), Longitude (east)",     cs.getName().getCode());
+        assertEquals("remarks", "Used in two-dimensional GeographicCRS.", cs.getRemarks().toString());
+    }
+}

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCSTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCSTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java?rev=1554601&r1=1554600&r2=1554601&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java
[UTF-8] Wed Jan  1 05:25:02 2014
@@ -24,6 +24,7 @@ import org.apache.sis.measure.Longitude;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.test.mock.GeodeticDatumMock;
 import org.apache.sis.test.TestUtilities;
+import org.apache.sis.test.XMLTestCase;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.DependsOnMethod;
 import org.junit.Test;
@@ -41,7 +42,12 @@ import static org.apache.sis.referencing
  * @module
  */
 @DependsOn(org.apache.sis.internal.referencing.FormulasTest.class)
-public final strictfp class DefaultEllipsoidTest extends DatumTestCase {
+public final strictfp class DefaultEllipsoidTest extends XMLTestCase {
+    /**
+     * An XML file in this package containing an ellipsoid definition.
+     */
+    private static final String XML_FILE = "Clarke 1880.xml";
+
     /**
      * Half of a minute of angle, in degrees.
      */
@@ -167,7 +173,7 @@ public final strictfp class DefaultEllip
      */
     @Test
     public void testXML() throws JAXBException {
-        final DefaultEllipsoid ellipsoid = unmarshall(DefaultEllipsoid.class, "Clarke 1880.xml");
+        final DefaultEllipsoid ellipsoid = unmarshalFile(DefaultEllipsoid.class, XML_FILE);
         assertEquals("name", "Clarke 1880 (international foot)", ellipsoid.getName().getCode());
         assertEquals("remarks", "Definition in feet assumed to be international foot.", ellipsoid.getRemarks().toString());
         assertFalse ("isIvfDefinitive",                       ellipsoid.isIvfDefinitive());
@@ -178,6 +184,6 @@ public final strictfp class DefaultEllip
         /*
          * Marshall and compare to the original file.
          */
-        assertMarshalEqualsFile("Clarke 1880.xml", ellipsoid);
+        assertMarshalEqualsFile(XML_FILE, ellipsoid, "xlmns:*", "xsi:schemaLocation");
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java?rev=1554601&r1=1554600&r2=1554601&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
[UTF-8] Wed Jan  1 05:25:02 2014
@@ -30,6 +30,7 @@ import org.opengis.test.Validators;
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.metadata.iso.extent.DefaultExtent;
 import org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox;
+import org.apache.sis.test.XMLTestCase;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.junit.Test;
@@ -53,7 +54,12 @@ import static org.apache.sis.referencing
   DefaultEllipsoidTest.class,
   BursaWolfParametersTest.class
 })
-public final strictfp class DefaultGeodeticDatumTest extends DatumTestCase {
+public final strictfp class DefaultGeodeticDatumTest extends XMLTestCase {
+    /**
+     * An XML file in this package containing a geodetic datum definition.
+     */
+    private static final String XML_FILE = "WGS 84.xml";
+
     /**
      * Tests the creation and serialization of a {@link DefaultGeodeticDatum}.
      */
@@ -220,7 +226,7 @@ public final strictfp class DefaultGeode
      */
     @Test
     public void testUnmarshalling() throws JAXBException {
-        final DefaultGeodeticDatum datum = unmarshall(DefaultGeodeticDatum.class, "WGS 84.xml");
+        final DefaultGeodeticDatum datum = unmarshalFile(DefaultGeodeticDatum.class, XML_FILE);
         assertIsWGS84(datum);
         assertIsWorld((GeographicBoundingBox) getSingleton(datum.getDomainOfValidity().getGeographicElements()));
         /*

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java?rev=1554601&r1=1554600&r2=1554601&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java
[UTF-8] Wed Jan  1 05:25:02 2014
@@ -25,6 +25,7 @@ import org.apache.sis.xml.Namespaces;
 import org.apache.sis.xml.MarshallerPool;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.internal.jaxb.LegacyNamespaces;
+import org.apache.sis.test.XMLTestCase;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.junit.Test;
@@ -43,7 +44,12 @@ import static org.apache.sis.test.mock.P
  * @module
  */
 @DependsOn(org.apache.sis.referencing.AbstractIdentifiedObjectTest.class)
-public final strictfp class DefaultPrimeMeridianTest extends DatumTestCase {
+public final strictfp class DefaultPrimeMeridianTest extends XMLTestCase {
+    /**
+     * An XML file in this package containing a prime meridian definition.
+     */
+    private static final String XML_FILE = "Greenwich.xml";
+
     /**
      * Tests {@link DefaultPrimeMeridian#toWKT()}.
      */
@@ -106,7 +112,7 @@ public final strictfp class DefaultPrime
      */
     @Test
     public void testUnmarshall() throws JAXBException {
-        final DefaultPrimeMeridian pm = unmarshall(DefaultPrimeMeridian.class, "Greenwich.xml");
+        final DefaultPrimeMeridian pm = unmarshalFile(DefaultPrimeMeridian.class, XML_FILE);
         assertIsGreenwich(pm);
     }
 
@@ -135,7 +141,7 @@ public final strictfp class DefaultPrime
     @Test
     @DependsOnMethod({"testUnmarshall", "testMarshall"})
     public void testParisMeridian() throws JAXBException {
-        final DefaultPrimeMeridian pm = unmarshall(DefaultPrimeMeridian.class, "Paris.xml");
+        final DefaultPrimeMeridian pm = unmarshalFile(DefaultPrimeMeridian.class, "Paris.xml");
         assertIsParis(pm);
         assertEquals("greenwichLongitude", 2.33722917, pm.getGreenwichLongitude(NonSI.DEGREE_ANGLE),
1E-12);
         assertEquals("Equivalent to 2°20′14.025″.", pm.getRemarks().toString());

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java?rev=1554601&r1=1554600&r2=1554601&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java
[UTF-8] Wed Jan  1 05:25:02 2014
@@ -21,6 +21,7 @@ import javax.xml.bind.JAXBException;
 import org.opengis.metadata.extent.GeographicBoundingBox;
 import org.opengis.referencing.datum.VerticalDatumType;
 import org.apache.sis.internal.referencing.VerticalDatumTypes;
+import org.apache.sis.test.XMLTestCase;
 import org.apache.sis.test.DependsOn;
 import org.junit.Test;
 
@@ -39,7 +40,12 @@ import static org.apache.sis.referencing
  * @module
  */
 @DependsOn(org.apache.sis.internal.referencing.VerticalDatumTypesTest.class)
-public final strictfp class DefaultVerticalDatumTest extends DatumTestCase {
+public final strictfp class DefaultVerticalDatumTest extends XMLTestCase {
+    /**
+     * An XML file in this package containing a vertical datum definition.
+     */
+    private static final String XML_FILE = "Mean Sea Level.xml";
+
     /**
      * Tests the {@link DefaultVerticalDatum#getVerticalDatumType()} method in a state
      * simulating unmarshalling of GML 3.2 document.
@@ -87,7 +93,7 @@ public final strictfp class DefaultVerti
      */
     @Test
     public void testUnmarshalling() throws JAXBException {
-        final DefaultVerticalDatum datum = unmarshall(DefaultVerticalDatum.class, "Mean Sea
Level.xml");
+        final DefaultVerticalDatum datum = unmarshalFile(DefaultVerticalDatum.class, XML_FILE);
         assertIsMeanSeaLevel(datum);
         assertIsWorld((GeographicBoundingBox) getSingleton(datum.getDomainOfValidity().getGeographicElements()));
         /*

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1554601&r1=1554600&r2=1554601&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] Wed Jan  1 05:25:02 2014
@@ -62,6 +62,7 @@ import org.junit.BeforeClass;
     org.apache.sis.referencing.cs.DirectionAlongMeridianTest.class,
     org.apache.sis.referencing.cs.DefaultCoordinateSystemAxisTest.class,
     org.apache.sis.referencing.cs.DefaultCartesianCSTest.class,
+    org.apache.sis.referencing.cs.DefaultEllipsoidalCSTest.class,
     org.apache.sis.referencing.cs.CoordinateSystemsTest.class,
     org.apache.sis.referencing.StandardDefinitionsTest.class,
     org.apache.sis.referencing.GeodeticObjectsTest.class,

Added: sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/cs/EllipsoidalCS.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/cs/EllipsoidalCS.xml?rev=1554601&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/cs/EllipsoidalCS.xml
(added)
+++ sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/cs/EllipsoidalCS.xml
Wed Jan  1 05:25:02 2014
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<gml:EllipsoidalCS xsi:schemaLocation = "http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/coordinateSystems.xsd"
+                   xmlns:gml          = "http://www.opengis.net/gml/3.2"
+                   xmlns:xsi          = "http://www.w3.org/2001/XMLSchema-instance"
+                   gml:id             = "epsg-cs-6422">
+  <gml:identifier codeSpace="OGP">urn:ogc:def:cs:EPSG::6422</gml:identifier>
+  <gml:name>Latitude (north), Longitude (east)</gml:name>
+  <gml:remarks>Used in two-dimensional GeographicCRS.</gml:remarks>
+  <gml:axis>
+    <gml:CoordinateSystemAxis gml:id="epsg-axis-106" uom="urn:ogc:def:uom:EPSG::9122">
+      <gml:identifier codeSpace="OGP">urn:ogc:def:axis:EPSG::106</gml:identifier>
+      <gml:name>Geodetic latitude</gml:name>
+      <gml:axisAbbrev>Lat</gml:axisAbbrev>
+      <gml:axisDirection codeSpace="EPSG">north</gml:axisDirection>
+      <gml:minimumValue>-90</gml:minimumValue>
+      <gml:maximumValue>+90</gml:maximumValue>
+      <gml:rangeMeaning codeSpace="EPSG">wraparound</gml:rangeMeaning>
+    </gml:CoordinateSystemAxis>
+  </gml:axis>
+  <gml:axis>
+    <gml:CoordinateSystemAxis gml:id="epsg-axis-107" uom="urn:ogc:def:uom:EPSG::9122">
+      <gml:identifier codeSpace="OGP">urn:ogc:def:axis:EPSG::107</gml:identifier>
+      <gml:name>Geodetic longitude</gml:name>
+      <gml:axisAbbrev>Long</gml:axisAbbrev>
+      <gml:axisDirection codeSpace="EPSG">east</gml:axisDirection>
+      <gml:minimumValue>-180</gml:minimumValue>
+      <gml:maximumValue>+180</gml:maximumValue>
+      <gml:rangeMeaning codeSpace="EPSG">exact</gml:rangeMeaning>
+    </gml:CoordinateSystemAxis>
+  </gml:axis>
+</gml:EllipsoidalCS>

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/cs/EllipsoidalCS.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/cs/EllipsoidalCS.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java?rev=1554601&r1=1554600&r2=1554601&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java
[UTF-8] Wed Jan  1 05:25:02 2014
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.test;
 
+import java.net.URL;
 import java.util.Map;
 import java.util.HashMap;
 import java.util.Locale;
@@ -35,13 +36,16 @@ import org.apache.sis.xml.MarshallerPool
 import org.apache.sis.xml.XML;
 import org.junit.After;
 
-import static org.opengis.test.Assert.*;
+import static org.apache.sis.test.Assert.*;
 
 
 /**
- * Base class of XML (un)marshalling tests. SIS (un)marshalling process can be partially
controlled
- * by a {@link Context}, which defines (among other) the locale and timezone. Some tests
will need
- * to fix the context to a particular locale and timezone before to execute the test.
+ * Base class of tests which contain some XML (un)marshalling.
+ * The subclasses do not need to be fully dedicated to XML.
+ *
+ * <p>SIS (un)marshalling process can be partially controlled by a {@link Context},
which defines (among other)
+ * the locale and timezone. Some tests will need to fix the context to a particular locale
and timezone before
+ * to execute the test.</p>
  *
  * <p>The {@link #context} field can be initialized by subclasses either explicitely
or by invoking
  * a {@code createContext(…)} convenience method. The {@link #clearContext()} method will
be invoked
@@ -155,11 +159,43 @@ public abstract strictfp class XMLTestCa
     }
 
     /**
+     * Returns the URL to the XML file of the given name.
+     * The file shall be in the same package than the final subclass of {@code this}.
+     *
+     * @param  filename The name of the XML file.
+     * @return The URL to the given XML file.
+     */
+    private URL getResource(final String filename) {
+        final URL resource = getClass().getResource(filename);
+        assertNotNull(filename, resource);
+        return resource;
+    }
+
+    /**
+     * Marshals the given object and ensure that the result is equals to the content of the
given file.
+     *
+     * @param  filename The name of the XML file in the package of the final subclass of
{@code this}.
+     * @param  object The object to marshal.
+     * @param  ignoredAttributes The fully-qualified names of attributes to ignore
+     *         (typically {@code "xmlns:*"} and {@code "xsi:schemaLocation"}).
+     * @throws JAXBException If an error occurred during marshalling.
+     *
+     * @see #unmarshalFile(Class, String)
+     */
+    protected final void assertMarshalEqualsFile(final String filename, final Object object,
+            final String... ignoredAttributes) throws JAXBException
+    {
+        assertXmlEquals(getResource(filename), marshal(object), ignoredAttributes);
+    }
+
+    /**
      * Marshals the given object using the {@linkplain #getMarshallerPool() test marshaller
pool}.
      *
      * @param  object The object to marshal.
      * @return The marshalled object.
      * @throws JAXBException If an error occurred while marshalling the object.
+     *
+     * @see #unmarshal(Class, String)
      */
     protected final String marshal(final Object object) throws JAXBException {
         final MarshallerPool pool = getMarshallerPool();
@@ -176,6 +212,8 @@ public abstract strictfp class XMLTestCa
      * @param  object The object to marshal.
      * @return The marshalled object.
      * @throws JAXBException If an error occurred while marshalling the object.
+     *
+     * @see #unmarshal(Unmarshaller, String)
      */
     protected final String marshal(final Marshaller marshaller, final Object object) throws
JAXBException {
         ArgumentChecks.ensureNonNull("marshaller", marshaller);
@@ -189,6 +227,28 @@ public abstract strictfp class XMLTestCa
     }
 
     /**
+     * Unmarshals the content of the given test file using the {@linkplain #getMarshallerPool()
test marshaller pool}.
+     * The resource is obtained by a call to {@code getClass().getResource(filename)}, which
implies that the file
+     * shall be in the same package than the subclass of {@code this}.
+     *
+     * @param  <T>  Compile-time type of {@code type} argument.
+     * @param  type The expected type of the unmarshalled object.
+     * @param  filename The name of the XML file in the package of the final subclass of
{@code this}.
+     * @return The object unmarshalled from the given file.
+     * @throws JAXBException If an error occurred during unmarshalling.
+     *
+     * @see #assertMarshalEqualsFile(String, Object, String...)
+     */
+    protected final <T> T unmarshalFile(final Class<T> type, final String filename)
throws JAXBException {
+        final MarshallerPool pool = getMarshallerPool();
+        final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
+        final Object object = unmarshaller.unmarshal(getResource(filename));
+        pool.recycle(unmarshaller);
+        assertInstanceOf(filename, type, object);
+        return type.cast(object);
+    }
+
+    /**
      * Unmarshals the given object using the {@linkplain #getMarshallerPool() test marshaller
pool}.
      *
      * @param  <T>  Compile-time type of {@code type} argument.
@@ -196,6 +256,8 @@ public abstract strictfp class XMLTestCa
      * @param  xml  The XML representation of the object to unmarshal.
      * @return The unmarshalled object.
      * @throws JAXBException If an error occurred while unmarshalling the XML.
+     *
+     * @see #marshal(Object)
      */
     protected final <T> T unmarshal(final Class<T> type, final String xml) throws
JAXBException {
         final MarshallerPool pool = getMarshallerPool();
@@ -213,6 +275,8 @@ public abstract strictfp class XMLTestCa
      * @param  xml The XML representation of the object to unmarshal.
      * @return The unmarshalled object.
      * @throws JAXBException If an error occurred while unmarshalling the XML.
+     *
+     * @see #marshal(Marshaller, Object)
      */
     protected final Object unmarshal(final Unmarshaller unmarshaller, final String xml) throws
JAXBException {
         ArgumentChecks.ensureNonNull("unmarshaller", unmarshaller);

Modified: sis/branches/JDK7/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java?rev=1554601&r1=1554600&r2=1554601&view=diff
==============================================================================
--- sis/branches/JDK7/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java
[UTF-8] Wed Jan  1 05:25:02 2014
@@ -17,16 +17,13 @@
 package org.apache.sis.internal.profile.fra;
 
 import java.util.Arrays;
-import java.io.IOException;
-import java.io.InputStream;
 import javax.xml.bind.JAXBException;
-import org.apache.sis.xml.XML;
 import org.apache.sis.metadata.iso.DefaultMetadata;
 import org.apache.sis.metadata.iso.ImmutableIdentifier;
 import org.apache.sis.metadata.iso.citation.DefaultCitation;
 import org.apache.sis.metadata.iso.citation.HardCodedCitations;
 import org.apache.sis.util.ComparisonMode;
-import org.apache.sis.test.TestCase;
+import org.apache.sis.test.XMLTestCase;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
@@ -42,11 +39,11 @@ import static org.apache.sis.test.TestUt
  * @since   0.4
  * @module
  */
-public final strictfp class DirectReferenceSystemTest extends TestCase {
+public final strictfp class DirectReferenceSystemTest extends XMLTestCase {
     /**
-     * An XML file representing a reference system tree.
+     * An XML file in this package containing a reference system definition.
      */
-    private static final String RESOURCE_FILE = "DirectReferenceSystem.xml";
+    private static final String XML_FILE = "DirectReferenceSystem.xml";
 
     /**
      * Creates the metadata object to be tested.
@@ -63,13 +60,11 @@ public final strictfp class DirectRefere
      * Ensures that the marshalling process of a {@link DefaultMetadata} produces
      * an XML document which complies with the one expected.
      *
-     * @throws IOException if an error occurred while reading the resource file.
      * @throws JAXBException if the marshalling process fails.
      */
     @Test
-    public void marshallingTest() throws IOException, JAXBException {
-        final String actual = XML.marshal(createMetadata());
-        assertXmlEquals(DirectReferenceSystemTest.class.getResource(RESOURCE_FILE), actual,
"xmlns:*", "xsi:schemaLocation");
+    public void marshallingTest() throws JAXBException {
+        assertMarshalEqualsFile(XML_FILE, createMetadata(), "xmlns:*", "xsi:schemaLocation");
     }
 
     /**
@@ -77,15 +72,11 @@ public final strictfp class DirectRefere
      * document produces an object containing all the information.
      *
      * @throws JAXBException if the unmarshalling process fails.
-     * @throws IOException if an error occurred while reading the resource file.
      */
     @Test
-    public void unmarshallingTest() throws JAXBException, IOException {
-        final DefaultMetadata result;
-        try (InputStream in = DirectReferenceSystemTest.class.getResourceAsStream(RESOURCE_FILE))
{
-            result = (DefaultMetadata) XML.unmarshal(in);
-        }
+    public void unmarshallingTest() throws JAXBException {
         final DefaultMetadata expected = createMetadata();
+        final DefaultMetadata result = unmarshalFile(DefaultMetadata.class, XML_FILE);
         /*
          * Compare in debug mode before to perform the real comparison,
          * for making easier to analyze the stack trace in case of failure.



Mime
View raw message