@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()); }
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; }
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; } }
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; }  }
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); }
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);  }