Can anyone tell me why this test is failing? I tried normal Java Date util and it also gave me the same result.
java.lang.AssertionError: expected: Wed Jan 01 00:07:00 CET 2014 but was: Fri Jan 31 00:06:00 CET 2014
public static Date addDaysToDate(Date fromDate, int days){
DateTime dateTime = new DateTime(fromDate);
return dateTime.plusDays(days).toDate();
}
@Test
public void test() throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd");
Date fromDate = sdf.parse("2014-06-30");
Date toDate = DateUtil.addDaysToDate(fromDate, 1);
assertEquals(sdf.parse("2014-07-01"), toDate);
}