### Question:
NameConverter { public Name convert(openadk.library.common.Name sifName) { if (sifName == null) { return null; } Name sliName = new Name(); mapSifNameIntoSliName(sifName, sliName); return sliName; }  Name convert(openadk.library.common.Name sifName); void mapSifNameIntoSliName(openadk.library.common.Name sifName, Name sliName);  }### Answer:
@Test public void nullNameShouldReturnNull() { openadk.library.common.Name sifName = null; Name sliName = converter.convert(sifName); Assert.assertNull(sliName); }
@Test public void emptySifNameShouldMapToNullAndDefaultValues() { openadk.library.common.Name sifName = new openadk.library.common.Name(); Name sliName = converter.convert(sifName); Assert.assertNotNull(sliName); Assert.assertEquals("Missing first name should map to Unknown", defaultName, sliName.getFirstName()); Assert.assertEquals("Missing last name should map to Unknown", defaultName, sliName.getLastSurname()); Assert.assertNull("Missing optional fields should map to null", sliName.getGenerationCodeSuffix()); Assert.assertNull("Missing optional fields should map to null", sliName.getMiddleName()); Assert.assertNull("Missing optional fields should map to null", sliName.getPersonalTitlePrefix()); }
@Test public void shouldMapSifNameToSliName() { Name sliName = converter.convert(createSifName(prefixes.get(0), suffixes.get(0))); Assert.assertNotNull(sliName); Assert.assertEquals("Incorrect prefix mapping", prefixes.get(0), sliName.getPersonalTitlePrefix()); Assert.assertEquals("Incorrect firstName mapping", firstName, sliName.getFirstName()); Assert.assertEquals("Incorrect lastName mapping", lastName, sliName.getLastSurname()); Assert.assertEquals("Incorrect middleName mapping", middleName, sliName.getMiddleName()); Assert.assertEquals("Incorrect suffix", suffixes.get(0), sliName.getGenerationCodeSuffix()); for (String prefix : prefixes) { sliName = converter.convert(createSifName(prefix, suffixes.get(0))); Assert.assertNotNull(sliName); Assert.assertEquals("Incorrect prefix mapping", prefix, sliName.getPersonalTitlePrefix()); } for (String suffix : suffixes) { sliName = converter.convert(createSifName(prefixes.get(0), suffix)); Assert.assertNotNull(sliName); Assert.assertEquals("Incorrect suffix", suffix, sliName.getGenerationCodeSuffix()); } sliName = converter.convert(createSifName("unsupported", suffixes.get(0))); Assert.assertNotNull(sliName); Assert.assertNull("Unsupported prefix should map to null", sliName.getPersonalTitlePrefix()); sliName = converter.convert(createSifName(prefixes.get(0), "unsupported")); Assert.assertNotNull(sliName); Assert.assertNull("Unsupported suffix should map to null", sliName.getGenerationCodeSuffix()); }