/** * Tests the {@link DefaultVerticalDatum#getVerticalDatumType()} method in a state * simulating unmarshalling of GML 3.2 document. * * @throws NoSuchFieldException Should never happen. * @throws IllegalAccessException Should never happen. */ @Test public void testAfterUnmarshal() throws NoSuchFieldException, IllegalAccessException { final Field typeField = DefaultVerticalDatum.class.getDeclaredField("type"); typeField.setAccessible(true); assertEquals(VerticalDatumType .GEOIDAL, typeForName(typeField, "Geoidal height")); assertEquals(VerticalDatumType .DEPTH, typeForName(typeField, "Some depth measurement")); assertEquals(VerticalDatumTypes.ELLIPSOIDAL, typeForName(typeField, "Ellipsoidal height")); assertEquals(VerticalDatumType .OTHER_SURFACE, typeForName(typeField, "NotADepth")); }
public void testGML31() throws JAXBException { final Version version = new Version("3.1"); final MarshallerPool pool = getMarshallerPool(); final Unmarshaller unmarshaller = pool.acquireUnmarshaller(); unmarshaller.setProperty(XML.GML_VERSION, version); final String xml = marshal(marshaller, datum); pool.recycle(marshaller); assertXmlEquals(
/** * Tests XML (un)marshalling. * * @throws JAXBException if an error occurred during (un)marshalling. */ @Test public void testXML() throws JAXBException { final DefaultVerticalDatum datum = unmarshalFile(DefaultVerticalDatum.class, XML_FILE); assertIsMeanSeaLevel(datum, true); /* * Following attribute does not exist in GML 3.2, so it has been inferred. * Our datum name is "Mean Sea Level", which is mapped to the geoidal type. */ assertEquals("vertDatumType", VerticalDatumType.GEOIDAL, datum.getVerticalDatumType()); /* * Values in the following tests are specific to our XML file. * The actual texts in the EPSG database are more descriptive. */ assertEquals("remarks", "Approximates geoid.", datum.getRemarks().toString()); assertEquals("scope", "Hydrography.", datum.getScope().toString()); assertEquals("anchorDefinition", "Averaged over a 19-year period.", datum.getAnchorPoint().toString()); /* * Test marshalling and compare with the original file. */ assertMarshalEqualsFile(XML_FILE, datum, "xmlns:*", "xsi:schemaLocation"); }