EmailFieldFormat { public static String plainText(final Locale locale) { return plainText(isNull(locale) ? null : locale.toString()); }  static UnaryOperator<String> textFormatterFrom(@NonNull final LoggingStrategy loggingStrategy); static Function<InternetAddress, String> emailFormatterFrom(@NonNull final LoggingStrategy loggingStrategy); static Function<Locale, String> localeFormatterFrom(@NonNull final LoggingStrategy loggingStrategy); static Function<Date, String> dateFormatterFrom(@NonNull final LoggingStrategy loggingStrategy); static String plainText(final Locale locale); static String plainText(final InternetAddress internetAddress); static String plainText(final String text); static String firstDozenThenStars(final InternetAddress internetAddress); static String firstDozenThenStars(final String text); static String textFromAt(final InternetAddress internetAddress); static String textFromAt(final String text); static String textUpToAt(final InternetAddress internetAddress); static String textUpToAt(final String text); static String dateFormat(final Date date); static String dateFormatWithZoneId(final Date date); static String nullValue();  }
@Test public void shouldPlainTextFormatLocale() throws Exception { Locale locale = Locale.ITALY; String givenFormattedText = EmailFieldFormat.plainText(locale); assertions.assertThat(givenFormattedText) .isNotNull() .isNotEmpty() .isEqualTo("it_IT"); }
@Test public void shouldPlainTextFormatNullLocale() throws Exception { Locale locale = null; String givenFormattedText = EmailFieldFormat.plainText(locale); assertions.assertThat(givenFormattedText) .isNotNull() .isNotEmpty() .isEqualTo(NULL); }
@Test public void shouldPlainTextFormatInternetAddress() throws Exception { InternetAddress internetAddress = new InternetAddress("test@email.com", "Mr. Test"); String givenFormattedText = EmailFieldFormat.plainText(internetAddress); assertions.assertThat(givenFormattedText) .isNotNull() .isNotEmpty() .isEqualTo("test@email.com"); }
@Test public void shouldPlainTextFormatNullInternetAddress() throws Exception { InternetAddress internetAddress = null; String givenFormattedText = EmailFieldFormat.plainText(internetAddress); assertions.assertThat(givenFormattedText) .isNotNull() .isNotEmpty() .isEqualTo(NULL); }
@Test public void shouldPlainTextFormatString() throws Exception { String text = "text"; String givenFormattedText = EmailFieldFormat.plainText(text); assertions.assertThat(givenFormattedText) .isNotNull() .isNotEmpty() .isEqualTo(text); }
@Test public void shouldPlainTextFormatNullString() throws Exception { String nullText = null; String givenFormattedText = EmailFieldFormat.plainText(nullText); assertions.assertThat(givenFormattedText) .isNotNull() .isNotEmpty() .isEqualTo(NULL); }