OpenImmoTransferDocument extends OpenImmoDocument<Openimmo> { @Override public Openimmo toObject() throws JAXBException { this.upgradeToLatestVersion(); return (Openimmo) OpenImmoUtils.createUnmarshaller().unmarshal(this.getDocument()); } OpenImmoTransferDocument(Document document); @Override OpenImmoVersion getDocumentVersion(); static boolean isReadable(Document doc); static OpenImmoTransferDocument newDocument(); static OpenImmoTransferDocument newDocument(Openimmo openimmo); @Override void setDocumentVersion(OpenImmoVersion version); @Override Openimmo toObject();  }
@Test public void testToObject() { try { String version = OpenImmoUtils.VERSION.toReadableVersion(); OpenImmoTransferDocument doc = new OpenImmoTransferDocument(buildExampleDocument(version)); Assert.assertEquals( version, OpenImmoUtils.VERSION, doc.getDocumentVersion()); Openimmo obj = doc.toObject(); Assert.assertNotNull( "Created object for transfer document.", obj); Assert.assertEquals( "Matching version between document and object.", doc.getDocumentVersion().toReadableVersion(), obj.getUebertragung().getVersion()); } catch (Exception ex) { LOGGER.error("Test of OpenImmoTransferDocument.toObject failed!"); LOGGER.error("> " + ex.getLocalizedMessage(), ex); Assert.fail("Test of OpenImmoTransferDocument.toObject failed!"); } }