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

From: Mike Fowler <mike(at)mlfowler(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Failing test in org.postgresql.test.jdbc2.DateTest
Date: 2011-02-28 10:23:17
Message-ID: 4D6B7795.1060400@mlfowler.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On 23/02/11 18:30, Mike Fowler wrote:
> On 23/02/11 16:42, I wrote:
>>
>> 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,
>>
> Oops, hold the phone. The test still broke on 1.6 but I didn't notice
> the error as the "build succeeded". The year value 23456 causes the
> test to fail as the maximum year in java.sql.date is 9999. However,
> when I change the year to 3456 the test fails:
>
> [junit] expected:<3456-01-01> but was:<456-01-01>

Turns out there was another place where a date was being set to
23456-01-01, which was misinterpreted by the 1.6 java.sql.Date. Attached
is the patch that brings all the date tests in line with the published
API. This has been tested on the three JDKs as noted above, and for all
three the test output is:

runtest:
[mkdir] Created dir: /home/mike/oss/pgjdbc/build/testresults
[junit] Testsuite: org.postgresql.test.jdbc2.Jdbc2TestSuite
[junit] Tests run: 293, Failures: 0, Errors: 0, Time elapsed:
61.521 sec
[junit]
[junit] Testsuite: org.postgresql.test.jdbc2.optional.OptionalTestSuite
[junit] Tests run: 40, Failures: 0, Errors: 0, Time elapsed: 3.564 sec
[junit]
[junit] Testsuite: org.postgresql.test.jdbc3.Jdbc3TestSuite
[junit] Tests run: 66, Failures: 0, Errors: 0, Time elapsed: 5.959 sec
[junit]
[junit] Testsuite: org.postgresql.test.xa.XATestSuite
[junit] Tests run: 0, Failures: 0, Errors: 0, Time elapsed: 0.072 sec
[junit]
[junit] ------------- Standard Output ---------------
[junit] Skipping XA tests because max_prepared_transactions = 0.
[junit] ------------- ---------------- ---------------

Regards,

--
Mike Fowler
Registered Linux user: 379787

Attachment Content-Type Size
dateTest-v2.patch text/x-diff 4.2 KB

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Lew 2011-02-28 12:56:08 Re: Failing test in org.postgresql.test.jdbc2.DateTest
Previous Message Clemens Eisserer 2011-02-25 20:46:00 Re: Slow query execution over WAN network