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.commons.ihe.hl7v2ws.wan;
17  
18  import ca.uhn.hl7v2.HL7Exception;
19  import ca.uhn.hl7v2.model.v26.message.ACK;
20  import org.junit.Ignore;
21  import org.junit.Test;
22  import org.openehealth.ipf.commons.core.modules.api.ValidationException;
23  import org.openehealth.ipf.commons.ihe.hl7v2ws.pcd01.Pcd01ValidatorTest;
24  
25  /**
26   * @author Mitko Kolev
27   * 
28   */
29  @Ignore
30  public class ContinuaWanValidatorTest extends Pcd01ValidatorTest {
31  
32  
33      @Test
34      public void testOximeterMessage() throws HL7Exception {
35          validate(load(getParser(), "wan/valid-oximeter-continua-wan.hl7v2"));
36      }
37      
38      @Test
39      public void testWeightScaleMessage() throws HL7Exception {
40          validate(load(getParser(), "wan/valid-scale-continua-wan.hl7v2"));
41      }
42      
43      @Test
44      public void testBPMessage() throws HL7Exception {
45          validate(load(getParser(), "wan/valid-bp-continua-wan.hl7v2"));
46      }
47  
48      @Test
49      public void testFitnessMessage() throws HL7Exception {
50          validate(load(getParser(), "wan/valid-fitness-continua-wan.hl7v2"));
51      }
52      @Test
53      public void testFitnessAndActivityMessage() throws HL7Exception {
54          validate(load(getParser(), "wan/valid-fitness-and-activity-continua-wan.hl7v2"));
55      }
56  
57      @Test
58      public void testThermometerMessage() throws HL7Exception {
59          validate(load(getParser(), "wan/valid-thermometer-continua-wan.hl7v2"));
60      }
61      
62      @Test
63      public void testGlucoseMessage() throws HL7Exception {
64          validate(load(getParser(), "wan/valid-glucose-continua-wan.hl7v2"));
65      }
66      
67      @Test
68      public void testResponseMessage() throws HL7Exception {
69          validate(load(getParser(), "wan/valid-wan-response.hl7v2"));
70      }
71      
72      @Test(expected=ValidationException.class)
73      public void testResponseMessage2() throws HL7Exception {
74          ACK rsp2 = load(getParser(), "pcd01/valid-pcd01-response2.hl7v2");
75          validate(rsp2);
76      }
77      
78      @Test(expected=ValidationException.class)
79      public void testInvalidResponseMessage() throws HL7Exception {
80          validate(load(getParser(), "wan/invalid-wan-response.hl7v2"));
81      }
82      
83      @Ignore
84      @Override
85      public void testSyntheticResponseMessage() {
86      }
87  
88      @Test(expected = HL7Exception.class)
89      public void testInvalidGlucoseMessage() throws HL7Exception {
90          // When OBX-5 is filled, obx-2 mus not be null. The message can not be parsed.
91          // The default obx-2 type must be set with the system property
92          // DEFAULT_OBX2_TYPE_PROP
93          validate(load(getParser(), "wan/invalid-glucose-continua-wan.hl7v2"));
94      }
95  
96  }