Package org.opengis.test.referencing
Class ReferencingTestCase
- Direct Known Subclasses:
AuthorityFactoryTest,CRSTest,ObjectFactoryTest,WKTParserTest
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
-
Field Summary
Fields inherited from class org.opengis.test.TestCase
configurationTip, units, validators -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a test case initialized to default values. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidverifyCoordinateSystem(CoordinateSystem cs, Class<? extends CoordinateSystem> type, AxisDirection[] directions, javax.measure.Unit<?>... axisUnits) Compares the type, axis units and directions of the given coordinate system against the expected values.protected voidverifyFlattenedSphere(Ellipsoid ellipsoid, String name, double semiMajor, double inverseFlattening, javax.measure.Unit<javax.measure.quantity.Length> axisUnit) Compares the name, axis lengths and inverse flattening factor of the given ellipsoid against the expected values.protected voidverifyGeographicExtent(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.protected voidverifyIdentification(IdentifiedObject object, String name, String identifier) Compares the name and identifier of the givenobjectagainst the expected values.protected voidverifyParameter(ParameterValueGroup group, String name, double value, javax.measure.Unit<?> unit) Compares an operation parameter against the expected value.protected voidverifyPrimeMeridian(PrimeMeridian primeMeridian, String name, double greenwichLongitude, javax.measure.Unit<javax.measure.quantity.Angle> angularUnit) Compares the name and Greenwich longitude of the given prime meridian against the expected values.protected voidverifyTimeExtent(Extent extent, Instant startTime, Instant endTime, double tolerance) Compares the temporal elements of the given extent against the expected values.protected voidverifyVerticalExtent(Extent extent, double minimumValue, double maximumValue, double tolerance, javax.measure.Unit<?> unit) Compares the vertical elements of the given extent against the expected values.Methods inherited from class org.opengis.test.TestCase
configuration, getEnabledFlags
-
Constructor Details
-
ReferencingTestCase
protected ReferencingTestCase()Creates a test case initialized to default values.
-
-
Method Details
-
verifyIdentification
Compares the name and identifier of the givenobjectagainst the expected values. This method allows for some flexibilities:- For
IdentifiedObject.getName():- Only the value returned by
Identifier.getCode()is verified. The code space, authority and version are ignored. - Only the characters that are valid for Unicode identifiers are compared (ignoring case), as documented in
Assertions.assertUnicodeIdentifierEquals(…).
- Only the value returned by
- For
IdentifiedObject.getIdentifiers():- Only the value returned by
Identifier.getCode()is verified. The code space, authority and version are ignored. - The identifiers collection can contain more identifiers than the expected one, and the expected identifier does not need to be first.
- The comparison is case-insensitive.
- Only the value returned by
objectisnull, then this method does nothing. Deciding ifnullobjects are allowed or not isValidator's job.- Parameters:
object- the object to verify, ornullif none.name- the expected name (ignoring code space), ornullif unrestricted.identifier- the expected identifier code (ignoring code space), ornullif unrestricted.
- For
-
verifyFlattenedSphere
protected void verifyFlattenedSphere(Ellipsoid ellipsoid, String name, double semiMajor, double inverseFlattening, javax.measure.Unit<javax.measure.quantity.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:IdentifiedObject.getName()allows for the same flexibilities as the one documented inverifyIdentification(…).Ellipsoid.getSemiMajorAxis()does not need to use the unit of measurement given by theaxisUnitargument. Unit conversion will be applied as needed.
- 3 decimal digits for
semiMajorvalues in metres. - 9 decimal digits for
inverseFlatteningvalues.
ellipsoidisnull, then this method does nothing. Deciding ifnulldatum are allowed or not isValidator's job.- Parameters:
ellipsoid- the ellipsoid to verify, ornullif none.name- the expected name (ignoring code space), ornullif unrestricted.semiMajor- the expected semi-major axis length, in units given by theaxisUnitargument.inverseFlattening- the expected inverse flattening factor.axisUnit- the unit of thesemiMajorargument (not necessarily the actual unit of the ellipsoid).- See Also:
-
verifyPrimeMeridian
protected void verifyPrimeMeridian(PrimeMeridian primeMeridian, String name, double greenwichLongitude, javax.measure.Unit<javax.measure.quantity.Angle> angularUnit) Compares the name and Greenwich longitude of the given prime meridian against the expected values. This method allows for some flexibilities:IdentifiedObject.getName()allows for the same flexibilities as the one documented inverifyIdentification(…).PrimeMeridian.getGreenwichLongitude()does not need to use the unit of measurement given by theangularUnitargument. Unit conversion will be applied as needed.
- 7 decimal digits for
greenwichLongitudevalues in degrees.
primeMeridianisnull, then this method does nothing. Deciding ifnullprime meridians are allowed or not isValidator's job.- Parameters:
primeMeridian- the prime meridian to verify, ornullif none.name- the expected name (ignoring code space), ornullif unrestricted.greenwichLongitude- the expected Greenwich longitude, in units given by theangularUnitargument.angularUnit- the unit of thegreenwichLongitudeargument (not necessarily the actual unit of the prime meridian).- See Also:
-
verifyCoordinateSystem
protected void verifyCoordinateSystem(CoordinateSystem cs, Class<? extends CoordinateSystem> type, AxisDirection[] directions, javax.measure.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
csisnull, then this method does nothing. Deciding ifnullcoordinate systems are allowed or not isValidator's job.- Parameters:
cs- the coordinate system to verify, ornullif none.type- the expected coordinate system type.directions- the expected axis directions. The length of this array determines the expectedcsdimension.axisUnits- the expected axis units. If the array length is less than thecsdimension, 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, javax.measure.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
unitargument. Unit conversion should be applied as needed by theParameterValue.doubleValue(Unit)method.
groupisnull, then this method does nothing. Deciding ifnullparameters are allowed or not isValidator'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 theunitargument.unit- the units of measurement of thevalueargument (not necessarily the unit actually used by the implementation).
- The parameter does not need to use the unit of measurement given by the
-
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
GeographicDescriptionelements:- Descriptions are considered optional. If the given
extentdoes not contain anyGeographicDescriptionelement, then the givendescriptionargument is ignored. - If the given
extentcontains more than oneGeographicDescriptionelement, then only one of them (not necessarily the first one) needs to have the givendescriptionvalue. Other elements are ignored.
- Descriptions are considered optional. If the given
- For
GeographicBoundingBoxelements:- Bounding boxes are considered optional. If the given
extentdoes not contain anyGeographicBoundingBoxelement, then all given bound arguments are ignored. - If the given
extentcontains more than oneGeographicBoundingBoxelement, then the union of them is compared against the given bound arguments.
- Bounding boxes are considered optional. If the given
If the given
extentisnull, then this method does nothing. Deciding ifnullextents are allowed or not isValidator's job.- Parameters:
extent- the extent to verify, ornullif none.description- the expected area, ornullif 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:
- For
-
verifyVerticalExtent
protected void verifyVerticalExtent(Extent extent, double minimumValue, double maximumValue, double tolerance, javax.measure.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
extentdoes not contain anyVerticalExtentelement, then this method does nothing. VerticalExtent.getMinimumValue()andgetMaximumValue()do not need to use the unit of measurement given by theunitargument. Unit conversions will be applied as needed ifVerticalExtent.getVerticalCRS()returns a non-null value.- If the given
extentcontains more than oneVerticalExtentelement, then the union of them is compared against the given bound arguments.
If the given
extentisnull, then this method does nothing. Deciding ifnullextents are allowed or not isValidator's job.- Parameters:
extent- the extent to verify, ornullif 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 ofminimumValue,maximumValueandtolerancearguments, ornullfor skipping the unit conversion.- See Also:
- Vertical extents are considered optional. If the given
-
verifyTimeExtent
protected void verifyTimeExtent(Extent extent, Instant startTime, Instant 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
extentdoes not contain anyTemporalExtentelement, or if extent bounds can not be represented asInstantobjects, then this method does nothing. - If the given
extentcontains more than oneTemporalExtentelement, then the union of them is compared against the given bound arguments.
extentisnull, then this method does nothing. Deciding ifnullextents are allowed or not isValidator's job.- Parameters:
extent- the extent to verify, ornullif none.startTime- the expected start time, ornullif unrestricted.endTime- the expected end time, ornullif unrestricted.tolerance- the tolerance threshold to use for comparison, in unit of days.- See Also:
- Temporal extents are considered optional. If the given
-