Class ReferencingTestCase

Object
TestCase
ReferencingTestCase
Direct Known Subclasses:
AuthorityFactoryTest, CRSParserTest, CRSTest, ObjectFactoryTest

public abstract class ReferencingTestCase extends TestCase
Base class of CoordinateReferenceSystem implementation tests. This base class provides verify(…) methods that subclasses can override if they need to alter the object verifications.
Since:
3.1
  • Constructor Details

    • ReferencingTestCase

      protected ReferencingTestCase()
      Creates a new test without factory. This constructor is provided for subclasses that instantiate their CoordinateReferenceSystem directly, without using any factory.
    • ReferencingTestCase

      protected ReferencingTestCase(Factory... factories)
      Creates a test case initialized to default values.
      Parameters:
      factories - the factories to be used by the test. Those factories are passed to the super-class constructor.
  • Method Details

    • verifyIdentification

      protected void verifyIdentification(IdentifiedObject object, String name, String identifier)
      Compares the name and identifier of the given object against the expected values. This method allows for some flexibilities: If the given object is null, then this method does nothing. Deciding if null objects are allowed or not is Validator's job.
      Parameters:
      object - the object to verify, or null if none.
      name - the expected name (ignoring code space), or null if unrestricted.
      identifier - the expected identifier code (ignoring code space), or null if unrestricted.
    • verifyFlattenedSphere

      protected void verifyFlattenedSphere(Ellipsoid ellipsoid, String name, double semiMajor, double inverseFlattening, Unit<Length> axisUnit)
      Compares the name, axis lengths and inverse flattening factor of the given ellipsoid against the expected values. This method allows for some flexibilities: The tolerance thresholds are 0.5 unit of the last digits of the values found in the EPSG database:
      • 3 decimal digits for semiMajor values in metres.
      • 9 decimal digits for inverseFlattening values.
      If the given ellipsoid is null, then this method does nothing. Deciding if null datum are allowed or not is Validator's job.
      Parameters:
      ellipsoid - the ellipsoid to verify, or null if none.
      name - the expected name (ignoring code space), or null if unrestricted.
      semiMajor - the expected semi-major axis length, in units given by the axisUnit argument.
      inverseFlattening - the expected inverse flattening factor.
      axisUnit - the unit of the semiMajor argument (not necessarily the actual unit of the ellipsoid).
      See Also:
    • verifyPrimeMeridian

      protected void verifyPrimeMeridian(PrimeMeridian primeMeridian, String name, double greenwichLongitude, Unit<Angle> angularUnit)
      Compares the name and Greenwich longitude of the given prime meridian against the expected values. This method allows for some flexibilities: The tolerance threshold is 0.5 unit of the last digit of the values found in the EPSG database:
      • 7 decimal digits for greenwichLongitude values in degrees.
      If the given primeMeridian is null, then this method does nothing. Deciding if null prime meridians are allowed or not is Validator's job.
      Parameters:
      primeMeridian - the prime meridian to verify, or null if none.
      name - the expected name (ignoring code space), or null if unrestricted.
      greenwichLongitude - the expected Greenwich longitude, in units given by the angularUnit argument.
      angularUnit - the unit of the greenwichLongitude argument (not necessarily the actual unit of the prime meridian).
      See Also:
    • verifyCoordinateSystem

      protected void verifyCoordinateSystem(CoordinateSystem cs, Class<? extends CoordinateSystem> type, AxisDirection[] directions, Unit<?>... axisUnits)
      Compares the type, axis units and directions of the given coordinate system against the expected values. This method does not verify the coordinate system name because it is usually not significant. This method does not verify axis names neither because the names specified by ISO 19111 and ISO 19162 differ.

      If the given cs is null, then this method does nothing. Deciding if null coordinate systems are allowed or not is Validator's job.

      Parameters:
      cs - the coordinate system to verify, or null if none.
      type - the expected coordinate system type.
      directions - the expected axis directions. The length of this array determines the expected cs dimension.
      axisUnits - the expected axis units. If the array length is less than the cs dimension, then the last unit is repeated for all remaining dimensions. If the array length is greater, than extra units are ignored.
      See Also:
    • verifyParameter

      protected void verifyParameter(ParameterValueGroup group, String name, double value, Unit<?> unit)
      Compares an operation parameter against the expected value. This method allows for some flexibilities:
      • The parameter does not need to use the unit of measurement given by the unit argument. Unit conversion should be applied as needed by the ParameterValue.doubleValue(Unit) method.
      If the given group is null, then this method does nothing. Deciding if null parameters are allowed or not is Validator's job.
      Parameters:
      group - the parameter group containing the parameter to test.
      name - the name of the parameter to test.
      value - the expected parameter value when expressed in units given by the unit argument.
      unit - the units of measurement of the value argument (not necessarily the unit actually used by the implementation).
    • verifyGeographicExtent

      protected void verifyGeographicExtent(Extent extent, String description, double southBoundLatitude, double westBoundLongitude, double northBoundLatitude, double eastBoundLongitude)
      Compares the geographic description and bounding box of the given extent against the expected values. This method allows for some flexibilities:
      • For GeographicDescription elements:
        • Descriptions are considered optional. If the given extent does not contain any GeographicDescription element, then the given description argument is ignored.
        • If the given extent contains more than one GeographicDescription element, then only one of them (not necessarily the first one) needs to have the given description value. Other elements are ignored.
      • For GeographicBoundingBox elements:
        • Bounding boxes are considered optional. If the given extent does not contain any GeographicBoundingBox element, then all given bound arguments are ignored.
        • If the given extent contains more than one GeographicBoundingBox element, then the union of them is compared against the given bound arguments.
      The tolerance threshold is 0.005° since geographic bounding box are only approximate information.

      If the given extent is null, then this method does nothing. Deciding if null extents are allowed or not is Validator's job.

      Parameters:
      extent - the extent to verify, or null if none.
      description - the expected area, or null if unrestricted.
      southBoundLatitude - the expected minimum latitude, or NaN if unrestricted.
      westBoundLongitude - the expected minimum longitude, or NaN if unrestricted.
      northBoundLatitude - the expected maximum latitude, or NaN if unrestricted.
      eastBoundLongitude - the expected maximum longitude, or NaN if unrestricted.
      See Also:
    • verifyVerticalExtent

      protected void verifyVerticalExtent(Extent extent, double minimumValue, double maximumValue, double tolerance, Unit<?> unit)
      Compares the vertical elements of the given extent against the expected values. This method allows for some flexibilities:
      • Vertical extents are considered optional. If the given extent does not contain any VerticalExtent element, then this method does nothing.
      • VerticalExtent.getMinimumValue() and getMaximumValue() do not need to use the unit of measurement given by the unit argument. Unit conversions will be applied as needed if VerticalExtent.getVerticalCRS() returns a non-null value.
      • If the given extent contains more than one VerticalExtent element, then the union of them is compared against the given bound arguments.

      If the given extent is null, then this method does nothing. Deciding if null extents are allowed or not is Validator's job.

      Parameters:
      extent - the extent to verify, or null if none.
      minimumValue - the expected minimal vertical value, or NaN if unrestricted.
      maximumValue - the expected maximal vertical value, or NaN if unrestricted.
      tolerance - the tolerance threshold to use for comparison.
      unit - the unit of minimumValue, maximumValue and tolerance arguments, or null for skipping the unit conversion.
      See Also:
    • verifyTimeExtent

      protected void verifyTimeExtent(Extent extent, Date startTime, Date endTime, double tolerance)
      Compares the temporal elements of the given extent against the expected values. This method allows for some flexibilities:
      • Temporal extents are considered optional. If the given extent does not contain any TemporalExtent element, then this method does nothing.
      • If the given extent contains more than one TemporalExtent element, then the union of them is compared against the given bound arguments.

      If the given extent is null, then this method does nothing. Deciding if null extents are allowed or not is Validator's job.

      Parameters:
      extent - the extent to verify, or null if none.
      startTime - the expected start time, or null if unrestricted.
      endTime - the expected end time, or null if unrestricted.
      tolerance - the tolerance threshold to use for comparison, in unit of days.
      See Also: