1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.commons.ihe.hl7v3;
17
18 import org.apache.cxf.helpers.IOUtils;
19 import org.junit.Test;
20 import org.openehealth.ipf.commons.core.modules.api.ValidationException;
21 import org.openehealth.ipf.commons.xml.CombinedXmlValidator;
22
23 public class HL7v3ValidatorTest {
24
25 @Test
26 public void testValidateOk() throws Exception {
27 String message = IOUtils.readStringFromStream(
28 getClass().getResourceAsStream("/xsd/prpa-valid.xml"));
29 CombinedXmlValidator validator = new CombinedXmlValidator();
30 validator.validate(message, PIXV3.Interactions.ITI_44_PIX.getRequestValidationProfile());
31 }
32
33 @Test(expected = ValidationException.class)
34 public void testValidateError() throws Exception {
35 String message = IOUtils.readStringFromStream(
36 getClass().getResourceAsStream("/xsd/prpa-invalid.xml"));
37 CombinedXmlValidator validator = new CombinedXmlValidator();
38 validator.validate(message,PIXV3.Interactions.ITI_44_PIX.getRequestValidationProfile());
39 }
40
41 }