DateUtil { public static String toUtcDateString(Instant instant) { notNull(instant, "instant can't be null"); return buildDateFormat().format(Date.from(instant)); }  static Date toUtcDate(String dateStr); static String toDateString(Instant instant); static String toUtcDateString(Instant instant); static Date now();  }
@Test public void testToUtcDateString() { val actual = toUtcDateString(Instant.ofEpochMilli(instMillis)); assertEquals(instString, actual); }
@Test(expected = IllegalArgumentException.class) public void testToUtcDateString_nullInstant() { DateUtil.toUtcDateString(null); }