EmailFieldFormat { public static String dateFormatWithZoneId(final Date date) { if (isNull(date)) return NULL; return DATE_FORMAT_WITH_ZONE_ID.format(date); }  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 shouldDateFormatWithZoneIdDoFormatDate() throws Exception { Date date = Date.from( LocalDate.of(2014, 7, 8) .atTime(4, 5, 1, 10) .atZone(ZoneId.of("UTC")) .toInstant() ); String givenFormattedText = EmailFieldFormat.dateFormatWithZoneId(date); assertions.assertThat(givenFormattedText) .isNotNull() .isNotEmpty() .isEqualTo("2014-07-08 04:05:01 UTC"); }
@Test public void shouldDateFormatWithZoneIdDoFormatNullDate() throws Exception { Date date = null; String givenFormattedText = EmailFieldFormat.dateFormatWithZoneId(date); assertions.assertThat(givenFormattedText) .isNotNull() .isNotEmpty() .isEqualTo(NULL); }