### Question:
DateUtil { public Date getDateFromGivenDate(Date date, int days, int hours,int minutes, int second) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.DATE, days); cal.add(Calendar.HOUR, hours); cal.add(Calendar.MINUTE, minutes); cal.add(Calendar.SECOND, second); return cal.getTime(); }  Date getDateFromNow(int days); Date getDateFromNow(int days, int hours, int minutes); static String dateToString(Date date, String dateFromat); Date getDateFromGivenDate(Date date, int days, int hours,int minutes, int second); Date addTimeOffset(Date date, int mins); static Date getUTCDate(); static Date getUTCDate(long epoh); static Date stringToDate(String dateString, String dateFromat);  }### Answer:
@Test public void testGetDateFromGivenDate(){ Date date = new Date(); int days=0; int hours=date.getHours(); int minutes=date.getMinutes(); int second=date.getSeconds(); Date currentDate = dateUtil.getDateFromGivenDate(date, days, 0, 0, 0); Assert.assertEquals(currentDate.getDay(),date.getDay()+days); Assert.assertEquals(currentDate.getHours(),hours); Assert.assertEquals(currentDate.getMinutes(),minutes); Assert.assertEquals(currentDate.getSeconds(),second); }