CDAR2Validator implements Validator<ClinicalDocument, Map<Object, Object>> { @Override public void validate(ClinicalDocument doc, Map<Object, Object> context) { boolean isValid = CDAUtil.validate(doc, retrieveValidationHandler(context)); if (! isValid) { throw new ValidationException("Clinical Document not valid!"); } }  @Override void validate(ClinicalDocument doc, Map<Object, Object> context);  }
@Test public final void validateCDA() throws Exception { LOG.info("Validating plain CDA document"); InputStream is = getClass().getResourceAsStream( "/builders/content/document/SampleCDADocument.xml"); ClinicalDocument cda = CDAUtil.load(is); validator.validate(cda, null); }
@Test(expected=ValidationException.class) public final void validateCDAError() throws Exception { LOG.info("Validating erroneous plain CDA document"); InputStream is = getClass().getResourceAsStream( "/builders/content/document/InvalidCDADocument.xml"); ClinicalDocument cda = CDAUtil.load(is); validator.validate(cda, null); }
@Test public final void validateCCD() throws Exception { LOG.info("Validating CCD document"); InputStream is = getClass().getResourceAsStream( "/builders/content/document/SampleCCDDocument.xml"); ClinicalDocument ccd = CDAUtil.load(is); validator.validate(ccd, null); }
@Test(expected = ValidationException.class) public final void validateCCDError() throws Exception { LOG.info("Validating erroneous CCD document"); InputStream is = getClass().getResourceAsStream( "/builders/content/document/InvalidCCDDocument.xml"); ClinicalDocument ccd = CDAUtil.load(is); validator.validate(ccd, null); }