@@ -0,0 +1,2131 @@
+/**%0A * %3C!-- LICENSE_TEXT_START --%3E%0A * %3C!-- LICENSE_TEXT_END --%3E%0A */%0A%0Apackage gov.nih.nci.caadapter.hl7.junit;%0A%0Aimport gov.nih.nci.caadapter.common.Message;%0Aimport gov.nih.nci.caadapter.hl7.transformation.TransformationService;%0Aimport gov.nih.nci.caadapter.hl7.transformation.data.XMLElement;%0A%0Aimport java.util.List;%0A%0Aimport junit.framework.JUnit4TestAdapter;%0Aimport junit.framework.TestCase;%0A%0Aimport org.junit.Test;%0A%0A/**%0A * The class tests the CSV to HL7v3 transformation service.%0A * %0A * @author OWNER: Wang, Eugene%0A * @author LAST UPDATE $Author: wangeug $%0A * @version Since caAdapter v4.0 revision $Revision: 1.1 $ date $Date: 2007-10-15 18:20:42 $%0A */%0A%0Apublic class DemoCSV2HL7v3TransformationTests extends TestCase %7B%0A%0A%0A%09 /**%0A%09  * Test general transformation%0A%09  */%0A%09 @Test public void testTransformation() throws Exception%7B%0A%09     String csvSrcFile=System.getProperty(%22hl7.transformation.src.file%22);%0A%09     String mapFile=System.getProperty(%22hl7.transformation.map.file%22);%0A%09%09 System.out.println(%22DemoCSV2HL7v3TransformationTests..sourceFie:%22+csvSrcFile);%0A%09%09 System.out.println(%22DemoCSV2HL7v3TransformationTests..mapFie:%22+mapFile);%0A%09%09 TransformationService ts = new TransformationService(mapFile, csvSrcFile);//%0A%09%09 List%3CXMLElement%3E xmlElements = ts.process();%0A%09     assertEquals(1,xmlElements.size());%0A%09     for(XMLElement rootElement: xmlElements) %7B%0A%09        %09System.out%0A%09%09%09%09%09%09.println(%22CSV2HL7v3TransformationTests.testTransformation()..message%5Cn%22+rootElement.toXML());%0A%09        %09rootElement.validate();%0A%09        %09List%3CMessage%3E vs = rootElement.getValidatorResults().getAllMessages();%0A%09        %09assertEquals(9,vs.size());%0A%09        %09boolean messageFlag = false;%0A%09        %09for(Message message:vs) %7B%0A%09        %09%09if (message.toString().equals(%22H3S Data Object modeCode has 2 attribute(s), but HL7 Attribute Encounter.consultant00.modeCode specifies cardinality 0..1%22))%0A%09        %09%09%7B%0A%09        %09%09%09messageFlag = true;%0A%09        %09%09%7D%0A%09        %09%7D%0A%09        %09assertEquals(true, messageFlag);%0A%09        %7D%0A%09        %0A%09 %7D%0A%0A%09 public static junit.framework.Test suite() %7B%0A%09%09  return new JUnit4TestAdapter(CSV2HL7v3TransformationTests.class);    %0A%09%7D%0A%7D%0A

add testcase