use of org.opengis.referencing.cs.CSAuthorityFactory in project sis by apache.
the class CodesTest method verify.
/**
* Compares the axis directions and units with EPSG definitions.
*
* @throws Exception if an error occurred while fetching the codes or querying the database.
*/
@Test
@SuppressWarnings("unchecked")
public void verify() throws Exception {
final CSAuthorityFactory factory = TestFactorySource.getSharedFactory();
final Field field = Codes.class.getDeclaredField("EPSG");
field.setAccessible(true);
for (final Codes c : ((Map<Codes, ?>) field.get(null)).keySet()) {
final CoordinateSystem cs = factory.createCoordinateSystem(String.valueOf(c.epsg));
final Unit<?> unit = cs.getAxis(0).getUnit();
final AxisDirection[] directions = new AxisDirection[cs.getDimension()];
for (int i = 0; i < directions.length; i++) {
assertEquals(unit, cs.getAxis(i).getUnit());
directions[i] = cs.getAxis(i).getDirection();
}
assertEquals("Codes.lookpup(…)", c.epsg, Codes.lookup(unit, directions));
}
}
Aggregations