DateUtil { public static String toDateString(Instant instant) { notNull(instant, "instant can't be null"); val date = new Date(instant.getEpochSecond() * 1000); return buildDateFormat().format(date); }  static Date toUtcDate(String dateStr); static String toDateString(Instant instant); static String toUtcDateString(Instant instant); static Date now();  }
@Test public void testToDateString() { val instant = Instant.parse("2000-01-01T00:00:00Z"); val actual = DateUtil.toDateString(instant); assertEquals("2000-01-01 00:00:00", actual); }
@Test(expected = IllegalArgumentException.class) public void testToDateString_nullInstant() { DateUtil.toDateString(null); }