SourcePatientNamePIDTransformer implements PIDTransformer { @Override public void fromHL7(String hl7Data, PatientInfo patientInfo) { notNull(patientInfo, "patientInfo cannot be null"); patientInfo.setName(Hl7v2Based.parse(hl7Data, XpnName.class)); }  @Override void fromHL7(String hl7Data, PatientInfo patientInfo); @Override List<String> toHL7(PatientInfo patientInfo);  }
@Test public void testFromHL7() { PatientInfo patientInfo = new PatientInfo(); transformer.fromHL7("Jo\\F\\man^Jo\\F\\chen^Jo\\F\\achim^von Jo\\F\\del^Jo\\F\\dler", patientInfo); Name name = patientInfo.getName(); assertNotNull(name); assertEquals("Jo|man", name.getFamilyName()); assertEquals("Jo|chen", name.getGivenName()); assertEquals("Jo|achim", name.getSecondAndFurtherGivenNames()); assertEquals("von Jo|del", name.getSuffix()); assertEquals("Jo|dler", name.getPrefix()); }
@Test public void testFromHL7Empty() { PatientInfo patientInfo = new PatientInfo(); transformer.fromHL7("^^", patientInfo); assertNull(patientInfo.getName()); }
@Test public void testFromHL7Null() { PatientInfo patientInfo = new PatientInfo(); transformer.fromHL7(null, patientInfo); assertNull(patientInfo.getName()); }