I have been adding validations to the feature. But i am getting really weird seemingly unrelated failures. In the junits one class fails, DateUtilsTest.java
Two fail, TestGetCaledar and TestGetWeekDayForDate. The failures are very peculiar and i can't put a finger on why this is happening. For instance in TestGetWeekDayForDate fails
Assert.assertEquals(WeekDay.SUNDAY, DateUtils.getWeekDayForDate(DateUtils.getDate("01/06/2008")));
junit.framework.AssertionFailedError: expected:<SUNDAY> but was:<SATURDAY>
I went to getWeekDayForDate and put a sysout,
public static WeekDay getWeekDayForDate(Date date) {
Calendar calendar = getCurrentDateCalendar();
calendar.setTime(date);
System.out.println(date);
System.out.println(Calendar.DAY_OF_WEEK);
return WeekDay.getWeekDay(calendar.get(Calendar.DAY_OF_WEEK));
}
This was the output
Sun Jun 01 00:00:00 IST 2008
7
The date is being shown as sunday but the day_of_week seems to be 7.
Could anyone tell me why this is happening?
for testgetcalendar
junit.framework.AssertionFailedError: expected:<26> but was:<25>, this is a similar error
regards
Chandan
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
A small change, The error is still there. But the code to verify it should have been.
public static WeekDay getWeekDayForDate(Date date) {
Calendar calendar = getCurrentDateCalendar();
calendar.setTime(date);
System.out.println(date);
//System.out.println(Calendar.DAY_OF_WEEK);
System.out.println(calendar.get(Calendar.DAY_OF_WEEK));
System.out.println(calendar.get(Calendar.DAY_OF_MONTH));
return WeekDay.getWeekDay(calendar.get(Calendar.DAY_OF_WEEK));
}
the output for this is
Sun Jun 01 00:00:00 IST 2008
7
31
i.e one day before .
regards
Chandan
It is really good that they pass here. But the behavior of the function
doesn't seem to be very regular or the something is seriously is wrong
with my comp at home :(