Failing test in org.postgresql.test.jdbc2.DateTest

Поиск
Список
Период
Сортировка
Искать
От
Mike Fowler
Тема
Failing test in org.postgresql.test.jdbc2.DateTest
Дата
Msg-id
4D6538EA.8080905@mlfowler.com
Список
Дерево обсуждения
Failing test in org.postgresql.test.jdbc2.DateTest Mike Fowler <mike@mlfowler.com>
Re: Failing test in org.postgresql.test.jdbc2.DateTest Mike Fowler <mike@mlfowler.com>
Re: Failing test in org.postgresql.test.jdbc2.DateTest Mike Fowler <mike@mlfowler.com>
Re: Failing test in org.postgresql.test.jdbc2.DateTest Kris Jurka <books@ejurka.com>
Re: Failing test in org.postgresql.test.jdbc2.DateTest Lew <noone@lewscanon.com>
Re: Failing test in org.postgresql.test.jdbc2.DateTest Mike Fowler <mike@mlfowler.com>
Hi all,

I have just pulled out the source from CVS and run the build and test 
and found a failure in the class noted in the subject. Specifically the 
test that fails is:

79    public void testSetDate() throws SQLException
80    {
...
111        ps.setObject(1, "1969-04-3", java.sql.Types.DATE);
112        assertEquals(1, ps.executeUpdate());
...
120        ps.setObject(1, java.sql.Date.valueOf("1912-5-1"), 
java.sql.Types.DATE);
121        assertEquals(1, ps.executeUpdate());
...

This only fails in my JDK 1.6 - it passes in 1.5. Looking at the 
java.sql.Date in the two source jars I have it's easy to see that the 
valueOf method has been completely rewritten in 1.6 (well, at least 
1.6.0_21 possibly earlier). Having looked at the API documentation has 
remained unchanged in 1.3, 1.4, 1.5 and 1.6 (1.2 I couldn't find by 
guessing) and reads:

* @param s a String object representing a date in
*        in the format "yyyy-mm-dd"

So it appears that the method now implements the API largely correctly, 
however as you can see above a single digit date is still accepted. 
Given that the API seems unchanged for so long, I'd recommend changing 
the tests to reflect the API.

I've attached a patch to do just that and it's been tested with the 
following JDKs:

1.4.2_19
1.5.0_22
1.6.0_21

Regards,

-- 
Mike Fowler
Registered Linux user: 379787

В списке pgsql-jdbc по дате отправления
От: Maurin, Marion
Дата:
От: Mike Fowler
Дата:
FAQ