PersonHelper { public static String formatBirthdate(Integer birthdateDD, Integer birthdateMM, Integer birthdateYYYY, Language language) { if (birthdateDD == null && birthdateMM == null && birthdateYYYY == null) { return ""; } else { String birthDate = DateHelper.getLocalDateFormat(language).toPattern(); birthDate = birthDate.replaceAll("d+", birthdateDD != null ? birthdateDD.toString() : ""); birthDate = birthDate.replaceAll("M+", birthdateMM != null ? birthdateMM.toString() : ""); birthDate = birthDate.replaceAll("y+", birthdateYYYY != null ? birthdateYYYY.toString() : ""); birthDate = birthDate.replaceAll("^[^\\d]*", "").replaceAll("[^\\d]*$", ""); return birthDate; } } private  PersonHelper(); static boolean areNamesSimilar(
		final String firstName,
		final String lastName,
		final String otherFirstName,
		final String otherLastName,
		Double similarityThreshold); static String normalizeString(String str); static String formatBirthdate(Integer birthdateDD, Integer birthdateMM, Integer birthdateYYYY, Language language); static String getAgeAndBirthdateString(
		Integer age,
		ApproximateAgeType ageType,
		Integer birthdateDD,
		Integer birthdateMM,
		Integer birthdateYYYY,
		Language language); static String buildBurialInfoString(BurialInfoDto dto, Language language); static String buildPhoneString(String phone, String phoneOwner); static String buildOccupationString(OccupationType occupationType, String occupationDetails); static String buildEducationString(EducationType educationType, String educationDetails); static final double DEFAULT_NAME_SIMILARITY_THRESHOLD; }
@Test public void testFormatBirthdateEN() throws Exception { assertEquals("", PersonHelper.formatBirthdate(null, null, null, Language.EN)); assertEquals("1990", PersonHelper.formatBirthdate(null, null, 1990, Language.EN)); assertEquals("7 assertEquals("7", PersonHelper.formatBirthdate(null, 7, null, Language.EN)); assertEquals("7/5", PersonHelper.formatBirthdate(5, 7, null, Language.EN)); assertEquals("5", PersonHelper.formatBirthdate(5, null, null, Language.EN)); assertEquals("5/1990", PersonHelper.formatBirthdate(5, null, 1990, Language.EN)); assertEquals("7/5/1990", PersonHelper.formatBirthdate(5, 7, 1990, Language.EN)); }
@Test public void testFormatBirthdateDE() throws Exception { assertEquals("", PersonHelper.formatBirthdate(null, null, null, Language.DE)); assertEquals("1990", PersonHelper.formatBirthdate(null, null, 1990, Language.DE)); assertEquals("7.1990", PersonHelper.formatBirthdate(null, 7, 1990, Language.DE)); assertEquals("7", PersonHelper.formatBirthdate(null, 7, null, Language.DE)); assertEquals("5.7", PersonHelper.formatBirthdate(5, 7, null, Language.DE)); assertEquals("5", PersonHelper.formatBirthdate(5, null, null, Language.DE)); assertEquals("5..1990", PersonHelper.formatBirthdate(5, null, 1990, Language.DE)); assertEquals("5.7.1990", PersonHelper.formatBirthdate(5, 7, 1990, Language.DE)); }