source: ccr/trunk/nhin-vista/projects/NHINC/Current/Product/Production/Adapters/General/MpiEJB/test/gov/hhs/fha/nhinc/adaptercomponentmpi/PatientCheckerTest.java@ 507

Last change on this file since 507 was 507, checked in by George Lilly, 15 years ago

NHIN gateway and adaptor for use on linux with VistA EHR and RPMS

File size: 2.5 KB
Line 
1/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5
6package gov.hhs.fha.nhinc.adaptercomponentmpi;
7
8import gov.hhs.fha.nhinc.mpilib.*;
9import gov.hhs.fha.nhinc.adaptercomponentmpi.hl7parsers.HL7Parser201306;
10import org.hl7.v3.II;
11import org.hl7.v3.PRPAIN201305UV;
12import org.hl7.v3.PRPAIN201306UV;
13import org.junit.After;
14import org.junit.AfterClass;
15import org.junit.Before;
16import org.junit.BeforeClass;
17import org.junit.Test;
18import static org.junit.Assert.*;
19import org.apache.commons.logging.Log;
20import org.apache.commons.logging.LogFactory;
21
22/**
23 *
24 * @author Jon Hoppesch
25 */
26public class PatientCheckerTest {
27 private static Log log = LogFactory.getLog(PatientCheckerTest.class);
28
29 public PatientCheckerTest() {
30 }
31
32 @BeforeClass
33 public static void setUpClass() throws Exception {
34 }
35
36 @AfterClass
37 public static void tearDownClass() throws Exception {
38 }
39
40 @Before
41 public void setUp() {
42 }
43
44 @After
45 public void tearDown() {
46 }
47
48 /**
49 * Test of FindPatient method, of class PatientChecker.
50 */
51 @Test
52 public void SinglePatientExists() {
53 log.info("SinglePatientExists");
54 II subjectId = new II();
55 subjectId.setRoot("2.16.840.1.113883.3.200");
56 subjectId.setExtension("1234");
57
58 PRPAIN201305UV query = TestHelper.build201305("Joe", "Smith", "M", "March 1, 1956", subjectId);
59
60 Identifier patId = new Identifier();
61 patId.setId("1234");
62 patId.setOrganizationId("2.16.840.1.113883.3.200");
63 Patient patient = TestHelper.createMpiPatient("Joe", "Smith", "M", "March 1, 1956", patId);
64
65 PRPAIN201306UV expResult = HL7Parser201306.BuildMessageFromMpiPatient(patient, query);
66
67 PRPAIN201306UV result = PatientChecker.FindPatient(query);
68
69 // Verify the messages match
70 TestHelper.AssertPatientIdsAreSame(expResult, result);
71 TestHelper.AssertPatientGendersAreSame(expResult, result);
72 TestHelper.AssertPatientBdaysAreSame(expResult, result);
73 TestHelper.AssertPatientNamesAreSame(expResult, result);
74 }
75
76 @Test
77 public void PatientDoesNotExist() {
78 log.info("PatientDoesNotExist");
79 II subjectId = new II();
80 subjectId.setRoot("2.16.840.1.113883.3.200");
81 subjectId.setExtension("1239");
82 PRPAIN201305UV query = TestHelper.build201305("Joe", "Anderson", "M", "March 1, 1956", subjectId);
83 PRPAIN201306UV result = PatientChecker.FindPatient(query);
84 assertNull(result);
85 }
86}
Note: See TracBrowser for help on using the repository browser.