DateOfBirthPIDTransformer implements PIDTransformer { @Override public List<String> toHL7(PatientInfo patientInfo) { notNull(patientInfo, "patientInfo cannot be null"); String date = patientInfo.getDateOfBirth(); return StringUtils.isEmpty(date) ? null : Collections.singletonList(date); }  @Override void fromHL7(String hl7Data, PatientInfo patientInfo); @Override List<String> toHL7(PatientInfo patientInfo);  }
@Test public void testToHL7() { PatientInfo patientInfo = new PatientInfo(); patientInfo.setDateOfBirth("123456+0100"); assertEquals("123456+0100", transformer.toHL7(patientInfo).get(0)); }
@Test public void testToHL7WithNoDate() { assertNull(transformer.toHL7(new PatientInfo())); }