DateOfBirthPIDTransformer implements PIDTransformer { @Override public void fromHL7(String hl7Data, PatientInfo patientInfo) { notNull(patientInfo, "patientInfo cannot be null"); if (StringUtils.isEmpty(hl7Data)) { return; } int pos = hl7Data.indexOf('^'); patientInfo.setDateOfBirth((pos > 0) ? hl7Data.substring(0, pos) : hl7Data); }  @Override void fromHL7(String hl7Data, PatientInfo patientInfo); @Override List<String> toHL7(PatientInfo patientInfo);  }
@Test public void testFromHL7() { PatientInfo patientInfo = new PatientInfo(); transformer.fromHL7("6543-0100^sdf", patientInfo); assertEquals("6543-0100", patientInfo.getDateOfBirth()); }
@Test public void testFromHL7Null() { PatientInfo patientInfo = new PatientInfo(); transformer.fromHL7(null, patientInfo); assertNull(patientInfo.getDateOfBirth()); }
@Test public void testFromHL7Empty() { PatientInfo patientInfo = new PatientInfo(); transformer.fromHL7("", patientInfo); assertNull(patientInfo.getDateOfBirth()); }