### Question:
DateUtils { public static Date getFirstDayOfMonth(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.DAY_OF_MONTH, 1); return cal.getTime(); } private  DateUtils(); static String getCurrentTime(); static String getCurrentTime(String format); static String format(Date date, String format); static String format(LocalDateTime localDateTime, String format); static String dateToString(Date date); static Date parse(String date, String format); static Date stringToDate(String str); static long differSec(Date d1, Date d2); static long differMs(Date d1, Date d2); static long diffHours(Date d1, Date d2); static long diffMin(Date d1, Date d2); static Date getSomeDay(Date date, int day); static int getHourIndex(Date date); static boolean compare(Date future, Date old); static Date getScheduleDate(String schedule); static String format2Readable(long ms); static Date getMonday(Date date); static Date getSunday(Date date); static Date getFirstDayOfMonth(Date date); static Date getSomeHourOfDay(Date date, int offsetHour); static Date getLastDayOfMonth(Date date); static Date getStartOfDay(Date inputDay); static Date getEndOfDay(Date inputDay); static Date getStartOfHour(Date inputDay); static Date getEndOfHour(Date inputDay); static Date getCurrentDate(); static Date add(final Date date, final int calendarField, final int amount); static long getRemainTime(Date baseTime, long intervalSeconds); static String getCurrentTimeStamp();  }### Answer:
@Test public void getFirstDayOfMonth() { Date d1 = DateUtils.stringToDate("2019-01-31 00:00:00"); Date curr = DateUtils.getFirstDayOfMonth(d1); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-01 00:00:00"); d1 = DateUtils.stringToDate("2019-01-31 01:59:00"); curr = DateUtils.getFirstDayOfMonth(d1); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-01 01:59:00"); }