/** * Positive test: Ensure that the unmarschalled Objects are of correct type * * <p>In order to allow For all (as far as this can be checked with generic methods) * * @throws Exception */ @Test public void test_MarshallUnmarshall_StringBuffer_checkObjectTypes() throws Exception { // instantiate marshaller Marshaller m = PersoSimJaxbContextProvider.getContext().createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); // Marshall/unmarshall through StringBuffer StringWriter strWriter = new StringWriter(); m.marshal(testPerso, strWriter); StringReader sr = new StringReader(strWriter.toString()); Unmarshaller um = PersoSimJaxbContextProvider.getContext().createUnmarshaller(); XmlPersonalization unmarshalledPerso = (XmlPersonalization) um.unmarshal(sr); // check all CardObjects, their children and all Identifiers of the card objet tree assertObjectTypes(unmarshalledPerso.getObjectTree()); }