OpenImmo_1_2_1 extends XmlConverter<OpenImmoDocument, OpenImmoVersion> { protected void downgradeXmlNamespace(Document doc) { XmlUtils.replaceNamespace(doc, OpenImmoUtils.OLD_NAMESPACE); }  @Override OpenImmoVersion getVersion(); @Override void downgradeToPreviousVersion(OpenImmoDocument doc); @Override @SuppressWarnings("Duplicates") void upgradeFromPreviousVersion(OpenImmoDocument doc);  }
@Test public void testDowngradeXmlNamespace() { try { Document doc = buildTransferDocumentForDowngrade(); Element root; String ns; root = XmlUtils.getRootElement(doc); ns = (root != null) ? StringUtils.trimToEmpty(root.getNamespaceURI()) : null; Assert.assertEquals( "XML namespace before conversion.", StringUtils.EMPTY, ns); new OpenImmo_1_2_1().downgradeXmlNamespace(doc); root = XmlUtils.getRootElement(doc); ns = (root != null) ? StringUtils.trimToEmpty(root.getNamespaceURI()) : null; Assert.assertEquals( "XML namespace after conversion.", OpenImmoUtils.OLD_NAMESPACE, ns); } catch (Exception ex) { LOGGER.error("Test of OpenImmo_1_2_1.downgradeXmlNamespace failed!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); Assert.fail("Test of OpenImmo_1_2_1.downgradeXmlNamespace failed!"); } }