org.opengis.test.referencing
Class TransformTestCase

Show UML class diagram
Object
  extended by TestCase
      extended by TransformTestCase
Direct Known Subclasses:
AffineTransformTest, ParameterizedTransformTest

public abstract class TransformTestCase
extends TestCase

Base class for MathTransform implementation tests. Subclasses shall assign a value to the transform field before to invoke any method in this class. The specified math transform shall support the following mandatory operations:

All other operations are optional. However subclasses shall declare which methods, if any, are unsupported. By default every operations are assumed supported. Tests can be disabled on a case-by-case basis by setting the appropriate is<Operation>Supported fields to false.

After TransformTestCase has been setup, subclasses can invoke any of the verify methods in their JUnit test methods. Callers must supply the input coordinate points to be used for testing purpose, since the range of valid values is usually transform-dependent.

Some general rules:

Since:
2.2

Field Summary
protected  double[] derivativeDeltas
          The deltas to use for approximating math transform derivatives by the finite differences method.
protected  boolean isDerivativeSupported
          true if MathTransform.derivative(DirectPosition) is supported.
protected  boolean isDoubleToDoubleSupported
          true if MathTransform.transform(double[],int,double[],int,int) is supported.
protected  boolean isDoubleToFloatSupported
          true if MathTransform.transform(double[],int,float[],int,int) is supported.
protected  boolean isFloatToDoubleSupported
          true if MathTransform.transform(float[],int,double[],int,int) is supported.
protected  boolean isFloatToFloatSupported
          true if MathTransform.transform(float[],int,float[],int,int) is supported.
protected  boolean isInverseTransformSupported
          true if MathTransform.inverse() is supported.
protected  boolean isOverlappingArraySupported
          true if the destination array can be the same than the source array, and the source and target region of the array can overlap.
protected  double tolerance
          Maximum difference to be accepted when comparing a transformed ordinate value with the expected value.
protected  ToleranceModifier toleranceModifier
          Optional modification to the tolerance threshold before to compare a coordinate points.
protected  MathTransform transform
          The transform being tested.
 
Fields inherited from class TestCase
configurationTip, listener, NO_FACTORY, validators
 
Constructor Summary
protected TransformTestCase()
          Creates a new test without factory.
protected TransformTestCase(Factory... factories)
          Creates a test case initialized to default values.
 
Method Summary
protected  void assertAllTestsEnabled()
          Deprecated. No replacement.
protected  void assertCoordinateEquals(String message, double[] expected, double[] actual, int index, boolean strict)
          Deprecated. The boolean argument has been replaced by a CalculationType argument.
protected  void assertCoordinateEquals(String message, double[] expected, double[] actual, int index, CalculationType mode)
          Asserts that a single coordinate is equal to the expected one within a positive delta.
protected  void assertCoordinateEquals(String message, double[] expected, float[] actual, int index, boolean strict)
          Deprecated. The boolean argument has been replaced by a CalculationType argument.
protected  void assertCoordinateEquals(String message, double[] expected, float[] actual, int index, CalculationType mode)
          Asserts that a single coordinate is equal to the expected one within a positive delta.
protected  void assertCoordinateEquals(String message, float[] expected, double[] actual, int index, boolean strict)
          Deprecated. The boolean argument has been replaced by a CalculationType argument.
protected  void assertCoordinateEquals(String message, float[] expected, double[] actual, int index, CalculationType mode)
          Asserts that a single coordinate is equal to the expected one within a positive delta.
protected  void assertCoordinateEquals(String message, float[] expected, float[] actual, int index, boolean strict)
          Deprecated. The boolean argument has been replaced by a CalculationType argument.
protected  void assertCoordinateEquals(String message, float[] expected, float[] actual, int index, CalculationType mode)
          Asserts that a single coordinate is equal to the expected one within a positive delta.
protected  void assertCoordinatesEqual(String message, int dimension, double[] expectedPts, int expectedOffset, double[] actualPts, int actualOffset, int numPoints, boolean strict)
          Deprecated. The boolean argument has been replaced by a CalculationType argument.
protected  void assertCoordinatesEqual(String message, int dimension, double[] expectedPts, int expectedOffset, double[] actualPts, int actualOffset, int numPoints, CalculationType mode)
          Asserts that coordinate values are equal to the expected ones within a positive delta.
protected  void assertCoordinatesEqual(String message, int dimension, double[] expectedPts, int expectedOffset, float[] actualPts, int actualOffset, int numPoints, boolean strict)
          Deprecated. The boolean argument has been replaced by a CalculationType argument.
protected  void assertCoordinatesEqual(String message, int dimension, double[] expectedPts, int expectedOffset, float[] actualPts, int actualOffset, int numPoints, CalculationType mode)
          Asserts that coordinate values are equal to the expected ones within a positive delta.
protected  void assertCoordinatesEqual(String message, int dimension, float[] expectedPts, int expectedOffset, double[] actualPts, int actualOffset, int numPoints, boolean strict)
          Deprecated. The boolean argument has been replaced by a CalculationType argument.
protected  void assertCoordinatesEqual(String message, int dimension, float[] expectedPts, int expectedOffset, double[] actualPts, int actualOffset, int numPoints, CalculationType mode)
          Asserts that coordinate values are equal to the expected ones within a positive delta.
protected  void assertCoordinatesEqual(String message, int dimension, float[] expectedPts, int expectedOffset, float[] actualPts, int actualOffset, int numPoints, boolean strict)
          Deprecated. The boolean argument has been replaced by a CalculationType argument.
protected  void assertCoordinatesEqual(String message, int dimension, float[] expectedPts, int expectedOffset, float[] actualPts, int actualOffset, int numPoints, CalculationType mode)
          Asserts that coordinate values are equal to the expected ones within a positive delta.
protected  void assertMatrixEquals(String message, Matrix expected, Matrix actual, Matrix tolmat)
          Asserts that a matrix of derivatives is equals to the expected ones within a positive delta.
 Configuration configuration()
          Returns information about the configuration of the test which has been run.
protected  void normalize(DirectPosition expected, DirectPosition actual, CalculationType mode)
          Invoked by all assertCoordinateEqual(…) methods before two positions are compared.
protected  double tolerance(double ordinate)
          Deprecated. Replaced by toleranceModifier.
protected  float[] verifyConsistency(float... sourceFloats)
          Transforms coordinates using various versions of MathTransform.transform(…) and verifies that they produce the same numerical values.
protected  void verifyDerivative(double... coordinate)
          Computes the derivative at the given point and compares the result with the finite differences approximation.
protected  float[] verifyInDomain(double[] minOrdinates, double[] maxOrdinates, int[] numOrdinates, Random randomGenerator)
          Verifies all supported transform operations in the given domain.
protected  void verifyInverse(double... coordinates)
          Transforms the given coordinates, applies the inverse transform and compares with the original values.
protected  void verifyInverse(float... coordinates)
          Transforms the given coordinates, applies the inverse transform and compares with the original values.
protected  void verifyTransform(double[] coordinates, double[] expected)
          Transforms the given coordinates and verifies that the result is equals (within a positive delta) to the expected ones.
 
Methods inherited from class TestCase
addTestListener, factories, factories, getEnabledFlags, removeTestListener
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transform

protected MathTransform transform
The transform being tested. Subclasses should assign a value to this field, together with the tolerance field, before any test is run.

All ParameterizedTransformTest test methods will set this field to a non-null value. Implementors can use this value for their own assertions after any test method has been run.

See Also:
tolerance

isDoubleToDoubleSupported

protected boolean isDoubleToDoubleSupported
true if MathTransform.transform(double[],int,double[],int,int) is supported. The default value is true. Vendor can set this value to false in order to test a transform which is not fully implemented.

See Also:
isFloatToFloatSupported, isDoubleToFloatSupported, isFloatToDoubleSupported, verifyConsistency(float[])

isFloatToFloatSupported

protected boolean isFloatToFloatSupported
true if MathTransform.transform(float[],int,float[],int,int) is supported. The default value is true. Vendor can set this value to false in order to test a transform which is not fully implemented.

See Also:
isDoubleToDoubleSupported, isDoubleToFloatSupported, isFloatToDoubleSupported, verifyConsistency(float[])

isDoubleToFloatSupported

protected boolean isDoubleToFloatSupported
true if MathTransform.transform(double[],int,float[],int,int) is supported. The default value is true. Vendor can set this value to false in order to test a transform which is not fully implemented.

See Also:
isDoubleToDoubleSupported, isFloatToFloatSupported, isFloatToDoubleSupported, verifyConsistency(float[])

isFloatToDoubleSupported

protected boolean isFloatToDoubleSupported
true if MathTransform.transform(float[],int,double[],int,int) is supported. The default value is true. Vendor can set this value to false in order to test a transform which is not fully implemented.

See Also:
isDoubleToDoubleSupported, isFloatToFloatSupported, isDoubleToFloatSupported, verifyConsistency(float[])

isOverlappingArraySupported

protected boolean isOverlappingArraySupported
true if the destination array can be the same than the source array, and the source and target region of the array can overlap. The default value is true. Vendor can set this value to false in order to test a transform which is not fully implemented.

See Also:
verifyConsistency(float[])

isInverseTransformSupported

protected boolean isInverseTransformSupported
true if MathTransform.inverse() is supported. The default value is true. Vendor can set this value to false in order to test a transform which is not fully implemented.

See Also:
verifyTransform(double[], double[])

isDerivativeSupported

protected boolean isDerivativeSupported
true if MathTransform.derivative(DirectPosition) is supported. The default value is true. Vendor can set this value to false in order to test a transform which is not fully implemented.

Since:
3.1
See Also:
derivativeDeltas, verifyDerivative(double[])

derivativeDeltas

protected double[] derivativeDeltas
The deltas to use for approximating math transform derivatives by the finite differences method. Each value in this array is the delta to use for the corresponding dimension, in units of the source ordinates of the transform being tested. The array length is theoretically the number of source dimensions, but different lengths are accepted for developers convenience. If the array is smaller than the number of dimensions, then the last delta value will be reused for all remaining dimensions.

Testers shall provide a non-null value if the isDerivativeSupported flag is set to true. Smaller delta would theoretically increase the finite difference precision. However in practice too small deltas decrease the precision, because of floating point errors when subtracting big numbers that are close in magnitude. In the particular case of map projections, experience suggests that a distance of 100 metres converted to decimal degrees is a good compromise. The conversion from metres to degrees can be done using the standard nautical mile length (1852.0 metres by minute of angle) as below:

derivativeDeltas = new double[] {100.0 / (60 * 1852)}; // Approximatively 100 metres.

Since:
3.1
See Also:
isDerivativeSupported, verifyDerivative(double[])

tolerance

protected double tolerance
Maximum difference to be accepted when comparing a transformed ordinate value with the expected value. By default this threshold is constant for all dimensions of all coordinates to be compared. If a subclass needs to adjust the tolerance threshold according the dimension or the coordinates values, then it should assign a value to the toleranceModifier field in addition to this one.

Example: the comparisons of geographic coordinates require increasing tolerance in longitude values as the latitude get closer to a pole. For such comparisons, this tolerance field shall be set to a threshold value in metres and the toleranceModifier field shall be assigned the ToleranceModifier.GEOGRAPHIC value. See the GEOGRAPHIC modifier javadoc for more information.

The default value is 0, which means that strict equality will be required. Subclasses should set a more suitable tolerance threshold when transform is assigned a value.

See Also:
transform, toleranceModifier

toleranceModifier

protected ToleranceModifier toleranceModifier
Optional modification to the tolerance threshold before to compare a coordinate points. ToleranceModifier instance assigned to this field (if any) are transform-dependent. The modifications applied by a particular ToleranceModifier instance to the tolerance thresholds is position-dependent.

Common values assigned to this field are ToleranceModifier.PROJECTION and ToleranceModifier.GEOGRAPHIC.

Since:
3.1
Constructor Detail

TransformTestCase

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


TransformTestCase

protected TransformTestCase(Factory... factories)
Creates a test case initialized to default values. The transform is initially null, the tolerance threshold is initially zero and all is<Operation>Supported are set to true unless at least one ImplementationDetails object disabled some tests.

Parameters:
factories - The factories to be used by the test. Those factories will be given to ImplementationDetails.configuration(Factory[]) in order to decide which tests should be enabled.
Method Detail

configuration

public Configuration configuration()
Returns information about the configuration of the test which has been run. This method returns a map containing:

Overrides:
configuration in class TestCase
Returns:
The configuration of the test being run, or an empty map if none. This method returns a modifiable map in order to allow subclasses to modify it.
Since:
3.1
See Also:
ImplementationDetails.configuration(Factory[])

tolerance

@Deprecated
protected double tolerance(double ordinate)
Deprecated. Replaced by toleranceModifier.

Returns the tolerance threshold for comparing the given ordinate value. The default implementation returns the tolerance value directly, thus implementing an absolute tolerance threshold. If a subclass needs a relative tolerance threshold instead, it can override this method as below:
return tolerance * Math.abs(ordinate);

Parameters:
ordinate - The ordinate value being compared.
Returns:
The absolute tolerance threshold to use for comparing the given ordinate.

assertAllTestsEnabled

@Deprecated
protected void assertAllTestsEnabled()
Deprecated. No replacement.

Ensures that all is<Operation>Supported fields are set to true. This method can be invoked before testing a math transform which is expected to be fully implemented.


verifyTransform

protected void verifyTransform(double[] coordinates,
                               double[] expected)
                        throws TransformException
Transforms the given coordinates and verifies that the result is equals (within a positive delta) to the expected ones. If the difference between an expected and actual ordinate value is greater than the tolerance threshold (after optional tolerance modification), then the assertion fails.

If isInverseTransformSupported is true, then this method will also transform the expected coordinate points using the inverse transform and compare with the source coordinates.

Parameters:
coordinates - The coordinate points to transform.
expected - The expect result of the transformation, or null if coordinates is expected to be null.
Throws:
TransformException - if the transformation failed.
See Also:
isInverseTransformSupported

verifyInverse

protected void verifyInverse(double... coordinates)
                      throws TransformException
Transforms the given coordinates, applies the inverse transform and compares with the original values. If a difference between the expected and actual ordinate values is greater than the tolerance threshold (after optional tolerance modification), then the assertion fails.

At the difference of verifyTransform(double[],double[]), this method does not require an array of expected values. The expected values are calculated from the transform itself.

Parameters:
coordinates - The source coordinates to transform.
Throws:
TransformException - if at least one coordinate can't be transformed.

verifyInverse

protected void verifyInverse(float... coordinates)
                      throws TransformException
Transforms the given coordinates, applies the inverse transform and compares with the original values. If a difference between the expected and actual ordinate values is greater than the tolerance threshold (after optional tolerance modification), then the assertion fails.

The default implementation delegates to verifyInverse(double[]).

Parameters:
coordinates - The source coordinates to transform.
Throws:
TransformException - if at least one coordinate can't be transformed.

verifyConsistency

protected float[] verifyConsistency(float... sourceFloats)
                             throws TransformException
Transforms coordinates using various versions of MathTransform.transform(…) and verifies that they produce the same numerical values. The values calculated by MathTransform.transform(DirectPosition,DirectPosition) are used as the reference. Other transform methods (operating on arrays) will be compared against that reference, unless their checks were disabled (see class javadoc for details).

This method expects an array of float values instead than double for making sure that the MathTransform.transform(float[], …) and MathTransform.transform(double[], …) methods produces the same numerical values. The double values may show extra digits when formatted in base 10, but this is not significant if their IEEE 754 representation (which use base 2) are equivalent.

This method does not verify the inverse transform or the derivatives. If desired, those later methods can be verified with the verifyInverse(float[]) and verifyDerivative(double[]) methods respectively.

Parameters:
sourceFloats - The source coordinates to transform as an array of float values.
Returns:
The transformed coordinates, returned for convenience.
Throws:
TransformException - if at least one coordinate can't be transformed.
See Also:
isDoubleToDoubleSupported, isFloatToFloatSupported, isDoubleToFloatSupported, isFloatToDoubleSupported, isOverlappingArraySupported

verifyDerivative

protected void verifyDerivative(double... coordinate)
                         throws TransformException
Computes the derivative at the given point and compares the result with the finite differences approximation.

All the three common forms of finite differences (forward difference, backward difference and central difference) are computed. If the finite difference method was a "perfect" approximation, all those three forms would produce identical results. In practice the results will differ, especially in areas where the derivative function varies fast. The difference between the results will be used as an estimation of the approximation accuracy.

The distance between the two points used by the central difference approximation shall be specified in the derivativeDeltas array, in units of the source CRS. If the length of the derivativeDeltas array is smaller than the number of source dimensions, then the last delta value is used for all additional dimensions. This allows specifying a single delta value (in an array of length 1) for all dimensions.

This method created the following objects:

Those information are then passed to the assertMatrixEquals(String, Matrix, Matrix, Matrix) method. Implementors can override the later method, for example in order to overwrite the tolerance values.

Parameters:
coordinate - The point where to compute the derivative, in units of the source CRS.
Throws:
TransformException - If the derivative can not be computed, or a point can not be transformed.
Since:
3.1
See Also:
MathTransform.derivative(DirectPosition), assertMatrixEquals(String, Matrix, Matrix, Matrix)

verifyInDomain

protected float[] verifyInDomain(double[] minOrdinates,
                                 double[] maxOrdinates,
                                 int[] numOrdinates,
                                 Random randomGenerator)
                          throws TransformException
Verifies all supported transform operations in the given domain. First, this method creates a grid of regularly spaced points along all source dimensions in the given envelope. Next, if the given random number generator is non-null, then this method adds small random displacements to every points and shuffle the coordinates in random order. Finally this method delegates the resulting array of coordinates to the following methods: The generated coordinates array is returned in case callers want to perform more tests in addition to the above-cited verifications.

Parameters:
minOrdinates - The minimal ordinate values of the domain where to test the transform.
maxOrdinates - The maximal ordinate values of the domain where to test the transform.
numOrdinates - The number of points along each dimension.
randomGenerator - An optional random number generator, or null for testing using a regular grid.
Returns:
The generated random coordinates inside the given domain of validity.
Throws:
TransformException - If a transform or a derivative can not be computed.
Since:
3.1

assertCoordinateEquals

protected final void assertCoordinateEquals(String message,
                                            float[] expected,
                                            float[] actual,
                                            int index,
                                            CalculationType mode)
                                     throws TransformFailure
Asserts that a single coordinate is equal to the expected one within a positive delta. If the comparison fails, the given message is completed with the expected and actual values, and the index of the ordinate where the failure was found.

Parameters:
message - The message to print in case of failure.
expected - The array of expected ordinate values.
actual - The array of ordinate values to check against the expected ones.
index - The index of the coordinate point being compared, for message formatting.
mode - Indicates if the coordinates being compared are the result of a direct or inverse transform, or if strict equality is requested.
Throws:
TransformFailure - If at least one ordinate value is not equal to the expected value.

assertCoordinateEquals

protected final void assertCoordinateEquals(String message,
                                            float[] expected,
                                            double[] actual,
                                            int index,
                                            CalculationType mode)
                                     throws TransformFailure
Asserts that a single coordinate is equal to the expected one within a positive delta. If the comparison fails, the given message is completed with the expected and actual values, and the index of the ordinate where the failure was found.

Parameters:
message - The message to print in case of failure.
expected - The array of expected ordinate values.
actual - The array of ordinate values to check against the expected ones.
index - The index of the coordinate point being compared, for message formatting.
mode - Indicates if the coordinates being compared are the result of a direct or inverse transform, or if strict equality is requested.
Throws:
TransformFailure - If at least one ordinate value is not equal to the expected value.

assertCoordinateEquals

protected final void assertCoordinateEquals(String message,
                                            double[] expected,
                                            float[] actual,
                                            int index,
                                            CalculationType mode)
                                     throws TransformFailure
Asserts that a single coordinate is equal to the expected one within a positive delta. If the comparison fails, the given message is completed with the expected and actual values, and the index of the ordinate where the failure was found.

Parameters:
message - The message to print in case of failure.
expected - The array of expected ordinate values.
actual - The array of ordinate values to check against the expected ones.
index - The index of the coordinate point being compared, for message formatting.
mode - Indicates if the coordinates being compared are the result of a direct or inverse transform, or if strict equality is requested.
Throws:
TransformFailure - If at least one ordinate value is not equal to the expected value.

assertCoordinateEquals

protected final void assertCoordinateEquals(String message,
                                            double[] expected,
                                            double[] actual,
                                            int index,
                                            CalculationType mode)
                                     throws TransformFailure
Asserts that a single coordinate is equal to the expected one within a positive delta. If the comparison fails, the given message is completed with the expected and actual values, and the index of the ordinate where the failure was found.

Parameters:
message - The message to print in case of failure.
expected - The array of expected ordinate values.
actual - The array of ordinate values to check against the expected ones.
index - The index of the coordinate point being compared, for message formatting.
mode - Indicates if the coordinates being compared are the result of a direct or inverse transform, or if strict equality is requested.
Throws:
TransformFailure - If at least one ordinate value is not equal to the expected value.

assertCoordinatesEqual

protected final void assertCoordinatesEqual(String message,
                                            int dimension,
                                            float[] expectedPts,
                                            int expectedOffset,
                                            float[] actualPts,
                                            int actualOffset,
                                            int numPoints,
                                            CalculationType mode)
                                     throws TransformFailure
Asserts that coordinate values are equal to the expected ones within a positive delta. If the comparison fails, the given message is completed with the expected and actual values, and the index of the coordinate where the failure was found.

Parameters:
message - The message to print in case of failure.
dimension - The dimension of each coordinate points in the arrays.
expectedPts - The array of expected coordinate values.
expectedOffset - Index of the first valid ordinate in the expectedPts array.
actualPts - The array of coordinate values to check against the expected ones.
actualOffset - Index of the first valid ordinate in the actualPts array.
numPoints - Number of coordinate points to compare.
mode - Indicates if the coordinates being compared are the result of a direct or inverse transform, or if strict equality is requested.
Throws:
TransformFailure - If at least one ordinate value is not equal to the expected value.

assertCoordinatesEqual

protected final void assertCoordinatesEqual(String message,
                                            int dimension,
                                            float[] expectedPts,
                                            int expectedOffset,
                                            double[] actualPts,
                                            int actualOffset,
                                            int numPoints,
                                            CalculationType mode)
                                     throws TransformFailure
Asserts that coordinate values are equal to the expected ones within a positive delta. If the comparison fails, the given message is completed with the expected and actual values, and the index of the coordinate where the failure was found.

Parameters:
message - The message to print in case of failure.
dimension - The dimension of each coordinate points in the arrays.
expectedPts - The array of expected coordinate values.
expectedOffset - Index of the first valid ordinate in the expectedPts array.
actualPts - The array of coordinate values to check against the expected ones.
actualOffset - Index of the first valid ordinate in the actualPts array.
numPoints - Number of coordinate points to compare.
mode - Indicates if the coordinates being compared are the result of a direct or inverse transform, or if strict equality is requested.
Throws:
TransformFailure - If at least one ordinate value is not equal to the expected value.

assertCoordinatesEqual

protected final void assertCoordinatesEqual(String message,
                                            int dimension,
                                            double[] expectedPts,
                                            int expectedOffset,
                                            float[] actualPts,
                                            int actualOffset,
                                            int numPoints,
                                            CalculationType mode)
                                     throws TransformFailure
Asserts that coordinate values are equal to the expected ones within a positive delta. If the comparison fails, the given message is completed with the expected and actual values, and the index of the coordinate where the failure was found.

Parameters:
message - The message to print in case of failure.
dimension - The dimension of each coordinate points in the arrays.
expectedPts - The array of expected coordinate values.
expectedOffset - Index of the first valid ordinate in the expectedPts array.
actualPts - The array of coordinate values to check against the expected ones.
actualOffset - Index of the first valid ordinate in the actualPts array.
numPoints - Number of coordinate points to compare.
mode - Indicates if the coordinates being compared are the result of a direct or inverse transform, or if strict equality is requested.
Throws:
TransformFailure - If at least one ordinate value is not equal to the expected value.

assertCoordinatesEqual

protected final void assertCoordinatesEqual(String message,
                                            int dimension,
                                            double[] expectedPts,
                                            int expectedOffset,
                                            double[] actualPts,
                                            int actualOffset,
                                            int numPoints,
                                            CalculationType mode)
                                     throws TransformFailure
Asserts that coordinate values are equal to the expected ones within a positive delta. If the comparison fails, the given message is completed with the expected and actual values, and the index of the coordinate where the failure was found.

Parameters:
message - The message to print in case of failure.
dimension - The dimension of each coordinate points in the arrays.
expectedPts - The array of expected coordinate values.
expectedOffset - Index of the first valid ordinate in the expectedPts array.
actualPts - The array of coordinate values to check against the expected ones.
actualOffset - Index of the first valid ordinate in the actualPts array.
numPoints - Number of coordinate points to compare.
mode - Indicates if the coordinates being compared are the result of a direct or inverse transform, or if strict equality is requested.
Throws:
TransformFailure - If at least one ordinate value is not equal to the expected value.

assertCoordinateEquals

@Deprecated
protected final void assertCoordinateEquals(String message,
                                                       float[] expected,
                                                       float[] actual,
                                                       int index,
                                                       boolean strict)
Deprecated. The boolean argument has been replaced by a CalculationType argument.

Parameters:
message - The message to print in case of failure.
expected - The array of expected ordinate values.
actual - The array of ordinate values to check against the expected ones.
index - The index of the coordinate point being compared, for message formatting.
strict - true for ignoring the tolerance threshold. In such case, ordinate values are checked for strict equality.

assertCoordinateEquals

@Deprecated
protected final void assertCoordinateEquals(String message,
                                                       float[] expected,
                                                       double[] actual,
                                                       int index,
                                                       boolean strict)
Deprecated. The boolean argument has been replaced by a CalculationType argument.

Parameters:
message - The message to print in case of failure.
expected - The array of expected ordinate values.
actual - The array of ordinate values to check against the expected ones.
index - The index of the coordinate point being compared, for message formatting.
strict - true for ignoring the tolerance threshold. In such case, ordinate values are checked for strict equality.

assertCoordinateEquals

@Deprecated
protected final void assertCoordinateEquals(String message,
                                                       double[] expected,
                                                       float[] actual,
                                                       int index,
                                                       boolean strict)
Deprecated. The boolean argument has been replaced by a CalculationType argument.

Parameters:
message - The message to print in case of failure.
expected - The array of expected ordinate values.
actual - The array of ordinate values to check against the expected ones.
index - The index of the coordinate point being compared, for message formatting.
strict - true for ignoring the tolerance threshold. In such case, ordinate values are checked for strict equality.

assertCoordinateEquals

@Deprecated
protected final void assertCoordinateEquals(String message,
                                                       double[] expected,
                                                       double[] actual,
                                                       int index,
                                                       boolean strict)
Deprecated. The boolean argument has been replaced by a CalculationType argument.

Parameters:
message - The message to print in case of failure.
expected - The array of expected ordinate values.
actual - The array of ordinate values to check against the expected ones.
index - The index of the coordinate point being compared, for message formatting.
strict - true for ignoring the tolerance threshold. In such case, ordinate values are checked for strict equality.

assertCoordinatesEqual

@Deprecated
protected final void assertCoordinatesEqual(String message,
                                                       int dimension,
                                                       float[] expectedPts,
                                                       int expectedOffset,
                                                       float[] actualPts,
                                                       int actualOffset,
                                                       int numPoints,
                                                       boolean strict)
Deprecated. The boolean argument has been replaced by a CalculationType argument.

Parameters:
message - The message to print in case of failure.
dimension - The dimension of each coordinate points in the arrays.
expectedPts - The array of expected coordinate values.
expectedOffset - Index of the first valid ordinate in the expectedPts array.
actualPts - The array of coordinate values to check against the expected ones.
actualOffset - Index of the first valid ordinate in the actualPts array.
numPoints - Number of coordinate points to compare.
strict - true for ignoring the tolerance threshold. In such case, ordinate values are checked for strict equality.

assertCoordinatesEqual

@Deprecated
protected final void assertCoordinatesEqual(String message,
                                                       int dimension,
                                                       float[] expectedPts,
                                                       int expectedOffset,
                                                       double[] actualPts,
                                                       int actualOffset,
                                                       int numPoints,
                                                       boolean strict)
Deprecated. The boolean argument has been replaced by a CalculationType argument.

Parameters:
message - The message to print in case of failure.
dimension - The dimension of each coordinate points in the arrays.
expectedPts - The array of expected coordinate values.
expectedOffset - Index of the first valid ordinate in the expectedPts array.
actualPts - The array of coordinate values to check against the expected ones.
actualOffset - Index of the first valid ordinate in the actualPts array.
numPoints - Number of coordinate points to compare.
strict - true for ignoring the tolerance threshold. In such case, ordinate values are checked for strict equality.

assertCoordinatesEqual

@Deprecated
protected final void assertCoordinatesEqual(String message,
                                                       int dimension,
                                                       double[] expectedPts,
                                                       int expectedOffset,
                                                       float[] actualPts,
                                                       int actualOffset,
                                                       int numPoints,
                                                       boolean strict)
Deprecated. The boolean argument has been replaced by a CalculationType argument.

Parameters:
message - The message to print in case of failure.
dimension - The dimension of each coordinate points in the arrays.
expectedPts - The array of expected coordinate values.
expectedOffset - Index of the first valid ordinate in the expectedPts array.
actualPts - The array of coordinate values to check against the expected ones.
actualOffset - Index of the first valid ordinate in the actualPts array.
numPoints - Number of coordinate points to compare.
strict - true for ignoring the tolerance threshold. In such case, ordinate values are checked for strict equality.

assertCoordinatesEqual

@Deprecated
protected final void assertCoordinatesEqual(String message,
                                                       int dimension,
                                                       double[] expectedPts,
                                                       int expectedOffset,
                                                       double[] actualPts,
                                                       int actualOffset,
                                                       int numPoints,
                                                       boolean strict)
Deprecated. The boolean argument has been replaced by a CalculationType argument.

Parameters:
message - The message to print in case of failure.
dimension - The dimension of each coordinate points in the arrays.
expectedPts - The array of expected coordinate values.
expectedOffset - Index of the first valid ordinate in the expectedPts array.
actualPts - The array of coordinate values to check against the expected ones.
actualOffset - Index of the first valid ordinate in the actualPts array.
numPoints - Number of coordinate points to compare.
strict - true for ignoring the tolerance threshold. In such case, ordinate values are checked for strict equality.

assertMatrixEquals

protected void assertMatrixEquals(String message,
                                  Matrix expected,
                                  Matrix actual,
                                  Matrix tolmat)
                           throws DerivativeFailure
Asserts that a matrix of derivatives is equals to the expected ones within a positive delta. If the comparison fails, the given message is completed with the expected and actual matrixes values.

For each matrix element, the tolerance value is given by the corresponding element in the tolmat matrix. This tolerance matrix is initialized by the verifyDerivative(double[]) method to the differences found between the 3 forms of finite difference (forward, backward, central). Developers can override this method and overwrite the tolmat elements if they wish different tolerance values.

Parameters:
message - The message to print in case of failure.
expected - The expected matrix of derivative values, estimated by finite differences.
actual - The actual matrix computed by the transform to be tested.
tolmat - The tolerance value for each matrix elements, or null for a strict comparison.
Throws:
DerivativeFailure - If at least one matrix element is not equal to the expected value.
Since:
3.1
See Also:
verifyDerivative(double[])

normalize

protected void normalize(DirectPosition expected,
                         DirectPosition actual,
                         CalculationType mode)
Invoked by all assertCoordinateEqual(…) methods before two positions are compared. This method allows subclasses to replace some equivalent ordinate values by a unique value. For example implementations may ensure that longitude values are contained in the ±180° range, applying 360° shifts if needed.

The default implementation does nothing. Subclasses can modify the actual ordinate values directly using the DirectPosition.setOrdinate(int, double) method.

Parameters:
expected - The expected ordinate value provided by the test case.
actual - The ordinate value computed by the transform being tested.
mode - Indicates if the coordinates being compared are the result of a direct or inverse transform, or if strict equality is requested.
Since:
3.1


Copyright © 1994-2013 Open Geospatial Consortium. All Rights Reserved.