### Question:
DateUtils { public static Date setDate(Date date, int year, int month, int day) { Calendar calendar = Calendar.getInstance(); if (date!=null) calendar.setTime(date); if (year>0) calendar.set(Calendar.YEAR, year); if (month>=0) calendar.set(Calendar.MONTH, month); if (day>0) calendar.set(Calendar.DAY_OF_MONTH, day); return calendar.getTime(); } private  DateUtils(); static Date getDateNow(); static Date getTimeNow(); static Date addDate(Date date, int years, int months, int days); static Date setDate(Date date, int year, int month, int day); static Date getDate(int year, int month, int day); static Date setTime(Date date, int hours, int minutes, int seconds, int millis); static Date getDateOnly(Date date); static Date parseDate(String sDate, Locale locale); static String formatDate(Date d, Locale locale); static String formatTime(Date d, Locale locale, boolean withSeconds); static String formatDayOfWeek(Date d, Locale locale, boolean longFormat); static String formatMonth(Date d, Locale locale, boolean longFormat); static int getWeekOfYear(Date d, Locale locale); static String formatMonth(int month, Locale locale, boolean longFormat); static String formatYear(Date d, Locale locale);  }### Answer:
@Test public void testSetDate() { Calendar now = Calendar.getInstance(); Date date = now.getTime(); Date pastDate = DateUtils.setDate(date, 1952, 11, 21); Calendar past = Calendar.getInstance(); past.setTime(pastDate); assertEquals(1952, past.get(Calendar.YEAR)); assertEquals(11, past.get(Calendar.MONTH)); assertEquals(21, past.get(Calendar.DAY_OF_MONTH)); assertEquals(now.get(Calendar.HOUR_OF_DAY), past.get(Calendar.HOUR_OF_DAY)); assertEquals(now.get(Calendar.MINUTE), past.get(Calendar.MINUTE)); assertEquals(now.get(Calendar.SECOND), past.get(Calendar.SECOND)); assertEquals(now.get(Calendar.MILLISECOND), past.get(Calendar.MILLISECOND)); }