/*
* Created on 28-Apr-2004
*/
package ca.uhn.hl7v2.preparser;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit tests of PreParser with XML-encoded messages.
*
* @author Bryan Tripp
* @version $Revision: 1.1 $ updated on $Date: 2007/02/19 02:24:52 $ by $Author: jamesagnew $
*/
public class PreParserXMLTest extends TestCase {
private String myMessage;
/**
* Constructor for PreParserXMLTest.
* @param arg0
*/
public PreParserXMLTest(String arg0) {
super(arg0);
myMessage = " | ^~/& UHN Vista ISO UHN ISO MPI ISO HealthLink ISO 20020429132718.734-0400 QBP Q22 QBP_Q21 855 P 2.4 Q22 Q22 Find Candidates HL7nnnn @PID.3.19583518684@PID.3.4.1CANON@PID.5.1.1ECG-Acharya@PID.5.2Nf@PID.5.7L@PID.7197104010000@PID.8M 100 TTH 13831ULTIuser2234564R&H Med I 100RD R ";
}
public static Test suite() {
TestSuite suite = new TestSuite(PreParserXMLTest.class);
return suite;
}
public void testFirstCompImplicit() throws Exception {
String[] result = PreParser.getFields(myMessage, new String[]{"MSH-9"});
assertEquals("QBP", result[0]);
}
public void testSecondComp() throws Exception {
String[] result = PreParser.getFields(myMessage, new String[]{"MSH-9-2"});
assertEquals("Q22", result[0]);
}
public void testSecondSubcomp() throws Exception {
String[] result = PreParser.getFields(myMessage, new String[]{"QPD-8-4-2"});
assertEquals("TTH", result[0]);
}
}