View Javadoc
1   /*
2    * Copyright 2011 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.openehealth.ipf.platform.camel.ihe.continua.hrn;
17  
18  import org.junit.Test;
19  import org.openehealth.ipf.modules.cda.CDAR2Validator;
20  import org.openhealthtools.mdht.uml.cda.ClinicalDocument;
21  import org.openhealthtools.mdht.uml.cda.util.CDAUtil;
22  
23  import java.io.InputStream;
24  
25  /**
26   * Test whether sample Continua HRN documents can be successfully
27   * validated with the MDHT framework.
28   * @author Dmytro Rud
29   */
30  public class DocumentsValidationTest {
31  
32      @Test
33      public void testDocumentsValidation() throws Exception {
34          doTest("12AB78.xml");
35          // doTest("generatedPHM.xml");
36          doTest("HL7_CDA_PHMR_Rich_Rodgers.xml");
37      }
38  
39      private void doTest(String fileName) throws Exception {
40          InputStream stream = getClass().getClassLoader().getResourceAsStream("continua-hrn/" + fileName);
41          ClinicalDocument document = CDAUtil.load(stream);
42          new CDAR2Validator().validate(document, null);
43      }
44  }