1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.commons.ihe.hl7v2ws.pcd01;
17
18 import ca.uhn.hl7v2.HL7Exception;
19 import org.junit.Ignore;
20 import org.junit.Test;
21 import org.openehealth.ipf.commons.core.modules.api.ValidationException;
22
23
24
25
26
27 @Ignore
28 public class QA_Pcd01OBRValidatorTest extends AbstractPCD01ValidatorTest {
29
30 @Test
31 public void testMaximalMessage() throws HL7Exception {
32 validate(maximumMessage);
33 }
34
35
36 @Test(expected = HL7Exception.class)
37 public void testMissingOBR1() throws HL7Exception {
38 validate(maxMsgReplace("OBR|1|", "OBR||"));
39 }
40
41 @Test(expected = HL7Exception.class)
42 public void testWrongSetIDForOBR1() throws HL7Exception {
43 validate(maxMsgReplace("OBR|2|AB112233", "OBR|1|AB112233"));
44 }
45
46 @Test(expected = HL7Exception.class)
47 public void testMissingOBR3() throws HL7Exception {
48 validate(maxMsgReplace("CD12345^AcmeAHDInc^ACDE48234567ABCD^EUI-64", ""));
49 }
50
51 @Test(expected = HL7Exception.class)
52 public void testSpaceAsOBR3() throws HL7Exception {
53 validate(maxMsgReplace("CD12345^AcmeAHDInc^ACDE48234567ABCD^EUI-64",
54 " "));
55 }
56
57 @Test(expected = HL7Exception.class)
58 public void testEmptyOBR3_1() throws HL7Exception {
59 validate(maxMsgReplace("CD12345^AcmeAHDInc^ACDE48234567ABCD^EUI-64",
60 "^AcmeAHDInc^ACDE48234567ABCD^EUI-64"));
61 }
62
63 @Test(expected = HL7Exception.class)
64 public void testSpaceAsOBR3_1() throws HL7Exception {
65 validate(maxMsgReplace("CD12345^AcmeAHDInc^ACDE48234567ABCD^EUI-64",
66 " ^AcmeAHDInc^ACDE48234567ABCD^EUI-64"));
67 }
68
69 @Test
70 public void testOnlyOBR31_32() throws HL7Exception {
71 validate(maxMsgReplace("CD12345^AcmeAHDInc^ACDE48234567ABCD^EUI-64",
72 "CD12345^AcmeAHDInc"));
73 }
74
75 @Test
76 public void testOnlyOBR31_33_34() throws HL7Exception {
77 validate(maxMsgReplace("CD12345^AcmeAHDInc^ACDE48234567ABCD^EUI-64",
78 "CD12345^^ACDE48234567ABCD^EUI-64"));
79 }
80
81 @Test(expected = ValidationException.class)
82 public void testOnlyOBR31() throws HL7Exception {
83 validate(maxMsgReplace("CD12345^AcmeAHDInc^ACDE48234567ABCD^EUI-64",
84 "CD12345"));
85 }
86
87 @Test(expected = HL7Exception.class)
88 public void testMissingOBR4() throws HL7Exception {
89 validate(maxMsgReplace("528391^MDC_DEV_SPEC_PROFILE_BP^MDC", ""));
90 }
91
92 @Test(expected = HL7Exception.class)
93 public void testSpaceAsOBR4() throws HL7Exception {
94 validate(maxMsgReplace("528391^MDC_DEV_SPEC_PROFILE_BP^MDC", " "));
95 }
96
97 @Test(expected = HL7Exception.class)
98 public void testMissingOBR4_2() throws HL7Exception {
99 validate(maxMsgReplace("528391^MDC_DEV_SPEC_PROFILE_BP^MDC",
100 "528391^^MDC"));
101 }
102
103 @Test(expected = HL7Exception.class)
104 public void testSpaceAsOBR4_2() throws HL7Exception {
105 validate(maxMsgReplace("528391^MDC_DEV_SPEC_PROFILE_BP^MDC",
106 "528391^ ^MDC"));
107 }
108
109 @Ignore
110 @Test(expected = HL7Exception.class)
111 public void testOBR7_olderThanOBR8() throws HL7Exception {
112 validate(maxMsgReplace("|20090813095715+0500|20090813105715+0500",
113 "|20100813095715+0500|20090813105715+0500"));
114 }
115
116 }