/**
* Tests the CRS factory.
*/
@Test
public void testCRS() throws FactoryException {
CRSAuthorityFactory factory = ReferencingFactoryFinder.getCRSAuthorityFactory("URN:OGC:DEF", null);
GeographicCRS crs;
try {
crs = factory.createGeographicCRS("CRS:84");
fail();
} catch (NoSuchAuthorityCodeException exception) {
// This is the expected exception.
assertEquals("CRS:84", exception.getAuthorityCode());
}
crs = factory.createGeographicCRS("urn:ogc:def:crs:CRS:WMS1.3:84");
assertSame(crs, factory.createGeographicCRS("urn:ogc:def:crs:CRS:1.3:84"));
assertSame(crs, factory.createGeographicCRS("URN:OGC:DEF:CRS:CRS:1.3:84"));
assertSame(crs, factory.createGeographicCRS("URN:OGC:DEF:CRS:CRS:84"));
assertSame(crs, factory.createGeographicCRS("urn:x-ogc:def:crs:CRS:1.3:84"));
assertSame(crs, CRS.decode("urn:ogc:def:crs:CRS:1.3:84"));
assertSame(crs, CRS.decode("CRS:84"));
assertNotSame(crs, DefaultGeographicCRS.WGS84);
assertFalse(DefaultGeographicCRS.WGS84.equals(crs));
assertTrue(CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84, crs));
// Test CRS:83
crs = factory.createGeographicCRS("urn:ogc:def:crs:CRS:1.3:83");
assertSame(crs, CRS.decode("CRS:83"));
assertFalse(CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84, crs));
}