ClinicalDocumentProvider { public POCDMT000040ClinicalDocument createClinicalDocumentFromXMLString(String xml) { POCDMT000040ClinicalDocument obj = null; try { JAXBContext context = JAXBContext.newInstance(new Class[] { POCDMT000040ClinicalDocument.class }); Unmarshaller unmarshaller = context.createUnmarshaller(); StringReader sr = new StringReader(xml); Object o = unmarshaller.unmarshal(sr); JAXBElement element = (JAXBElement)o; obj = (POCDMT000040ClinicalDocument)element.getValue(); } catch (Exception e) { e.printStackTrace(); } return obj; }  POCDMT000040ClinicalDocument createClinicalDocumentFromXMLString(String xml); String createConsentDirective(OrganizationPolicy orgPolicy, String patientName, String patientId, String patientIdType, String patientBirthDate, String patientGender, String authorization, String intendedPOU, List<String> allowedPOU, String primaryRecipient, List<String> allowedRecipients, List<String> maskingActions, List<String> redactActions, String pdfstring, String xacml);  }
@Test public void testCreateClinicalDocumentFromXMLStringAndCreateClinicalDocumentStringFromObject() throws IOException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, SAXException { String c32="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<?xml-stylesheet href=\"http: POCDMT000040ClinicalDocument document=clinicalDocumentProvider.createClinicalDocumentFromXMLString(c32); assertEquals(document.getClass().getName(),"org.hl7.v3.POCDMT000040ClinicalDocument"); Method createClinicalDocumentStringFromObject=ClinicalDocumentProvider.class.getDeclaredMethod("createClinicalDocumentStringFromObject",POCDMT000040ClinicalDocument.class); createClinicalDocumentStringFromObject.setAccessible(true); assertXMLEqual("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n<ClinicalDocument xsi:schemaLocation=\"http: ,createClinicalDocumentStringFromObject.invoke(clinicalDocumentProvider, document).toString()); }