### Question:
DateUtils { public static Date getLatest( Date... dates ) { return Lists.newArrayList( dates ).stream() .filter( Objects::nonNull ) .max( Date::compareTo ).orElse( null ); }  static String getIso8601( Date date ); static String getIso8601NoTz( Date date ); static String getLongGmtDateString( Date date ); static String getLongDateString( Date date ); static String getLongDateString(); static String getMediumDateString( Date date ); static String getMediumDateString(); static String getHttpDateString( Date date ); static Date max( Date date1, Date date2 ); static Date max( Collection<Date> dates ); static Date min( Date date1, Date date2 ); static Date min( Collection<Date> dates ); static Date getMediumDate( String string ); static boolean between( Date baseDate, Date startDate, Date endDate ); static boolean strictlyBetween( Date baseDate, Date startDate, Date endDate ); static long getDays( Date date ); static long getDays( Date startDate, Date endDate ); static long getDaysInclusive( Date startDate, Date endDate ); static int daysBetween( Date startDate, Date endDate ); static boolean isToday( Date date ); static int monthsBetween( Date startDate, Date endDate ); static int daysSince1900( Date date ); static Date getNextDate( int hourOfDay, Date now ); static Date getEpoch(); static String getSqlDateString( Date date ); static boolean dateIsValid( String dateString ); static boolean dateIsValid( org.hisp.dhis.calendar.Calendar calendar, String dateString ); static boolean dateTimeIsValid( final String dateTimeString ); static long getSecondsUntilTomorrow( int hour ); static Date getDateForTomorrow( int hour ); static Date getDateAfterAddition( Date date, int days ); static Date calculateDateFrom( final Date date, final int addend, final int chronoUnit ); static List<Period> setNames( List<Period> periods, I18nFormat format ); static String getPrettyInterval( Date start, Date end ); static String getPrettyInterval( long ms ); static Date parseDate( final String dateString ); static Date getDate( LocalDateTime time ); static Date nowMinusDuration( String duration ); static Duration getDuration( String duration ); static Timestamp asTimestamp( Date date ); static java.sql.Date asSqlDate( Date date ); static Date getLatest( Date... dates ); static Date removeTimeStamp( Date date ); static final PeriodFormatter DAY_SECOND_FORMAT; static final double DAYS_IN_YEAR; }### Answer:
@Test public void testGetLatestDate() { Date jan3 = new DateTime( 2019, 1, 3, 0, 0 ).toDate(); Date mar21 = new DateTime( 2019, 3, 21, 0, 0 ).toDate(); Date aug17 = new DateTime( 2019, 8, 17, 0, 0 ).toDate(); assertEquals( aug17, DateUtils.getLatest( mar21, null, aug17, null, jan3, null ) ); assertEquals( null, DateUtils.getLatest( null, null ) ); }