Conformance tests

The GeoAPI conformance tests are currently written in Java as JUnit tests, but future version will open to more languages. GeoAPI tests provide two kinds of Java classes:

The test cases and validators are grouped in util, metadata, referencing and geometry packages.

Download as Maven dependency

Conformance tests are deployed on the Maven Central Repository and can be used in a Maven project with the following declaration in the pom.xml file:

<dependencies>
  <dependency>
    <groupId>org.opengis</groupId>
    <artifactId>geoapi-conformance</artifactId>
    <version>3.0.1</version>
  </dependency>
</dependencies>

Writing custom tests

Implementers can either write their own JUnit tests, or extend some of the existing implementations. With the later approach, implementers can override the existing test methods for finer control on the tests being executed. In every cases, implementers can use the static methods for testing their implementation consistency. For example an implementer can test the validity of his Coordinate Reference System objects and related objects in a test suite like below:

Java code example
package org.myproject;

import org.junit.*;
import static org.opengis.test.Validators.*;

public class MyTests {
    @Test
    public void testMyCRS() {
        CoordinateReferenceSystem crs = ...
        validate(crs);

        MathTransform transform = ...
        validate(transform);
    }
}

Validators are thread-safe except for the configuration phase (which is optional and usually executed only once before the tests begin). Validators test the logical consistency of their argument. For example if given a chain of concatenated transforms, validate(object) will ensure that the source dimension of a transformation step is equals to the target dimension of the previous step. Dependencies are traversed recursively, for example validating a CoordinateReferenceSystem object implies validating its CoordinateSystem and Datum attributes.