PatientAddressPIDTransformer implements PIDTransformer { @Override public void fromHL7(String hl7Data, PatientInfo patientInfo) { notNull(patientInfo, "patientInfo cannot be null"); patientInfo.setAddress(Hl7v2Based.parse(hl7Data, Address.class)); }  @Override void fromHL7(String hl7Data, PatientInfo patientInfo); @Override List<String> toHL7(PatientInfo patientInfo);  }
@Test public void testFromHL7() { PatientInfo patientInfo = new PatientInfo(); transformer.fromHL7("I live here 42^^^^^ECU", patientInfo); assertEquals("I live here 42", patientInfo.getAddress().getStreetAddress()); assertEquals("ECU", patientInfo.getAddress().getCountry()); }
@Test public void testFromHL7Empty() { PatientInfo patientInfo = new PatientInfo(); transformer.fromHL7("", patientInfo); assertNull(patientInfo.getAddress()); }
@Test public void testFromHL7Null() { PatientInfo patientInfo = new PatientInfo(); transformer.fromHL7(null, patientInfo); assertNull(patientInfo.getAddress()); }