@Test
public void testGetXPath() throws Exception {

    final URL resource = AbstractCoreIntegrationTest.class.getResource("kernel/valid-metadata.iso19139.xml");
    final String sampleMetadataXml = Resources.toString(resource, Constants.CHARSET);
    final GPathResult xml = AbstractFormatterTest.parseXml(sampleMetadataXml);
    GPathResult polygon = null, bbox = null;
    final Iterator iterator = xml.depthFirst();
    while (iterator.hasNext()) {
        Object elem = iterator.next();
        if (elem instanceof GPathResult) {
            GPathResult result = (GPathResult) elem;
            if (result.name().equals("gmd:EX_BoundingPolygon")) {
                polygon = result;
            }
            if (result.name().equals("gmd:EX_GeographicBoundingBox")) {
                bbox = result;
            }
        }
    }
    assertEquals("gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent[2]/gmd:EX_Extent/gmd:geographicElement[2]/gmd:EX_GeographicBoundingBox", functions.getXPathFrom(bbox));
    assertEquals("gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent[2]/gmd:EX_Extent/gmd:geographicElement[1]/gmd:EX_BoundingPolygon", functions.getXPathFrom(polygon));
}