Re: Failing test in org.postgresql.test.jdbc2.DateTest - Mailing list pgsql-jdbc

From Mike Fowler
Subject Re: Failing test in org.postgresql.test.jdbc2.DateTest
Date
Msg-id 4D6B7795.1060400@mlfowler.com
Whole thread Raw
In response to Re: Failing test in org.postgresql.test.jdbc2.DateTest  (Mike Fowler <mike@mlfowler.com>)
Responses Re: Failing test in org.postgresql.test.jdbc2.DateTest
List 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

pgsql-jdbc by date:

Previous
From: Clemens Eisserer
Date:
Subject: Re: Slow query execution over WAN network
Next
From: Lew
Date:
Subject: Re: Failing test in org.postgresql.test.jdbc2.DateTest