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