Unit Test DateTest.java fails in GMT 0 ~ 14 countries

10 views
Skip to first unread message

yichao.zhang

unread,
Feb 3, 2007, 7:54:52 PM2/3/07
to Google Web Toolkit Contributors
When I checked out google-web-toolkit source code and run the unit
test, surprised to get a Failure in DateTest.java.
trunk/user/test/com/google/gwt/emultest/java/util/DateTest.java
The reason is time difference. It only passes in GMT -1 ~ -12, and
fails in GMT 0 ~ 14 countires
my fix is to comment all buggish method just like testGetHours().

the code is:
/** Testing for public int java.util.Date.getDate()* */
public void testGetDate() {
......
Date accum1 = create(PAST);
int a1 = accum1.getDate();
assertEquals(4, a1); ===========> it fails in GMT 0 ~ 14
countries
......
}
.......
Date create(String s) {
if (s.equals(FUTURE)) {
return new Date("12/30/2010 3:4:5 GMT");
} else if (s.equals(PAST)) {
return new Date("1/5/1880 GMT");
} .......
}

/**
* Testing for public int java.util.Date.getHours()
*/
public void testGetHours() {
// Cannot be done because each time zone will give a different
// answer
}

Rob Jellinghaus

unread,
Feb 4, 2007, 12:06:24 AM2/4/07
to Google Web Toolkit Contributors
On Feb 3, 4:54 pm, "yichao.zhang" <yichao.zh...@gmail.com> wrote:
> When I checked out google-web-toolkit source code and run the unit
> test, surprised to get a Failure in DateTest.java.
> trunk/user/test/com/google/gwt/emultest/java/util/DateTest.java
> The reason is time difference. It only passes in GMT -1 ~ -12, and
> fails in GMT 0 ~ 14 countires

You might add this as a comment to issue 640, which is a similar
failure of DateTest on days of the month >28. Or, file another
issue. In any case, please enter it into the issue tracker
somehow :-)
Cheers!
Rob

yichao.zhang

unread,
Feb 4, 2007, 9:34:28 AM2/4/07
to Google Web Toolkit Contributors
Have filed it as issue 650

-Yichao

Reply all
Reply to author
Forward
0 new messages