source: ccr/trunk/nhin-vista/projects/NHINC/Current/Product/Production/Common/NhincDataTransformsLib/test/gov/hhs/fha/nhinc/transform/subdisc/HL7MessageIdGeneratorTest.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.6 KB
Line 
1/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5package gov.hhs.fha.nhinc.transform.subdisc;
6
7import gov.hhs.fha.nhinc.transform.subdisc.HL7MessageIdGenerator;
8import gov.hhs.fha.nhinc.transform.subdisc.HL7Constants;
9import org.hl7.v3.II;
10import org.junit.After;
11import org.junit.AfterClass;
12import org.junit.Before;
13import org.junit.BeforeClass;
14import org.junit.Test;
15import static org.junit.Assert.*;
16import org.apache.commons.logging.Log;
17import org.apache.commons.logging.LogFactory;
18
19/**
20 *
21 * @author Jon Hoppesch
22 */
23public class HL7MessageIdGeneratorTest {
24
25 private static Log log = LogFactory.getLog(HL7MessageIdGeneratorTest.class);
26
27 public HL7MessageIdGeneratorTest() {
28 }
29
30 @BeforeClass
31 public static void setUpClass() throws Exception {
32 }
33
34 @AfterClass
35 public static void tearDownClass() throws Exception {
36 }
37
38 @Before
39 public void setUp() {
40 }
41
42 @After
43 public void tearDown() {
44 }
45
46 /**
47 * Test of GenerateHL7MessageId method, of class HL7MessageIdGenerator.
48 * device id
49 */
50 @Test
51 public void testGenerateHL7MessageId_1arg() {
52 log.info("testGenerateHL7MessageId_1arg");
53
54 String myDeviceId = "2.16.840.1.113883.3.166.4";
55
56 II result = HL7MessageIdGenerator.GenerateHL7MessageId(myDeviceId);
57 assertEquals(result.getRoot(), "2.16.840.1.113883.3.166.4");
58 assertNotNull(result.getExtension());
59 }
60
61 /**
62 * Test of GenerateHL7MessageId method, of class HL7MessageIdGenerator.
63 * device id, no input
64 */
65 @Test
66 public void testGenerateHL7MessageId_1arg_NoInput() {
67 log.info("testGenerateHL7MessageId_1arg");
68
69 II result = HL7MessageIdGenerator.GenerateHL7MessageId(null);
70 assertEquals(result.getRoot(), HL7Constants.DEFAULT_LOCAL_DEVICE_ID);
71 assertNotNull(result.getExtension());
72 }
73
74 /**
75 * Test of GenerateHL7MessageId method, of class HL7MessageIdGenerator.
76 */
77 @Test
78 public void testGenerateHL7MessageId_0args() {
79 log.info("testGenerateHL7MessageId_0args");
80
81 II result = HL7MessageIdGenerator.GenerateHL7MessageId();
82 assertEquals(result.getRoot(), HL7Constants.DEFAULT_LOCAL_DEVICE_ID);
83 assertNotNull(result.getExtension());
84 }
85
86 /**
87 * Test of GenerateMessageId method, of class HL7MessageIdGenerator.
88 */
89 @Test
90 public void testGenerateMessageId() {
91 log.info("testGenerateMessageId");
92
93 String result = HL7MessageIdGenerator.GenerateMessageId();
94 assertNotNull(result);
95 }
96}
Note: See TracBrowser for help on using the repository browser.