### Question:
DateUtil { public static long midnightUtc(Calendar cal) { int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH); int day = cal.get(Calendar.DAY_OF_MONTH); cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); cal.setTimeInMillis(0); cal.set(year, month, day, 0, 0, 0); return cal.getTimeInMillis(); } private  DateUtil(); static Long toLong(Date date); static Date toDate(Long date); static Date addMinutes(int minutes); static long midnightUtc(Calendar cal); static long tomorrowMidnightUtc(); static long todayMidnightUtc(); static final int MILLIS_TO_MINUTES; }### Answer:
@Test public void testMidnightUtcPlus() { Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC+2")); cal.set(2014, Calendar.JULY, 22, 1, 44, 55); long expected = 1405987200000l; long actual = DateUtil.midnightUtc(cal); assertEquals("Unexpected date returned", expected, actual); }
@Test public void testMidnightUtcMinus() { Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC-2")); cal.set(2014, Calendar.JULY, 22, 23, 44, 55); long expected = 1405987200000l; long actual = DateUtil.midnightUtc(cal); assertEquals("Unexpected date returned", expected, actual); }