### Question:
DemographicsToBirthDataConverter { public BirthData convert(Demographics sifDemographics) { if (sifDemographics == null) { return null; } BirthData sliBirthData = new BirthData(); sliBirthData.setCountryOfBirthCode(sifDemographics.getCountryOfBirth()); sliBirthData.setCityOfBirth(sifDemographics.getPlaceOfBirth()); if (SLI_STATE_CODES.contains(sifDemographics.getStateOfBirth())) { sliBirthData.setStateOfBirthAbbreviation(sifDemographics.getStateOfBirth()); } SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); if (sifDemographics.getBirthDate() != null) { sliBirthData.setBirthDate(dateFormat.format(sifDemographics.getBirthDate().getTime())); } if (sifDemographics.getCountryArrivalDate() != null) { sliBirthData.setDateEnteredUS(dateFormat.format(sifDemographics.getCountryArrivalDate().getTime())); } return sliBirthData; }  BirthData convert(Demographics sifDemographics);  }### Answer:
@Test public void nullNameShouldReturnNull() { openadk.library.common.Demographics sifDemographics = null; BirthData sliName = converter.convert(sifDemographics); Assert.assertNull(sliName); }
@Test public void emptySifDemographicShouldMapToNullBirthDataValues() { openadk.library.common.Demographics sifDemographics = new openadk.library.common.Demographics(); BirthData sliBirthData = converter.convert(sifDemographics); Assert.assertNotNull(sliBirthData); Assert.assertNull(sliBirthData.getCityOfBirth()); Assert.assertNull(sliBirthData.getCountryOfBirthCode()); Assert.assertNull(sliBirthData.getStateOfBirthAbbreviation()); Assert.assertNull(sliBirthData.getBirthDate()); Assert.assertNull(sliBirthData.getDateEnteredUS()); }
@Test public void shouldMapSifDemographicToSliBirthData() { for (String state : SLI_STATE_CODES) { BirthData sliBirthData = converter.convert(createSifDemographics(state)); Assert.assertNotNull(sliBirthData); Assert.assertEquals(placeOfBirth, sliBirthData.getCityOfBirth()); Assert.assertEquals(countryOfBirth, sliBirthData.getCountryOfBirthCode()); Assert.assertEquals(state, sliBirthData.getStateOfBirthAbbreviation()); Assert.assertEquals(DATE_FORMAT.format(birthDate.getTime()), sliBirthData.getBirthDate()); Assert.assertEquals(DATE_FORMAT.format(countryArrivalDate.getTime()), sliBirthData.getDateEnteredUS()); } BirthData sliBirthData = converter.convert(createSifDemographics("invlaid_state")); Assert.assertNotNull(sliBirthData); Assert.assertNull(sliBirthData.getStateOfBirthAbbreviation()); }