db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@apache.org>
Subject Re: Common Junit test conversion mistakes
Date Mon, 13 Aug 2007 16:10:19 GMT
Kathey Marsden wrote:
> Ramin Moazeni wrote:
>> Hi Kathey
>>
>> Regarding sample tests, among the tests I converted, I think
>> jdbcapi/parameterMetadataJdbc30.java conversion is a good
>> test for starters. It is not too long, not too short and not that 
>> difficult.
>>
>> Maybe we can have a diff of the original and the converted
>> test with couple of sentences before each fixture, decorators, ....
>>
>> Also, I think we need to mention that in the FAQ page that we need to
>> remove the test from JDBCHarnessJavaTest.java as well.
>>   
> That sounds good.  Perhaps Dan or others would be willing to pour over 
> the test and make sure it doesn't show any bad examples.

All the assertSQLState() have the incorrect parameters in that test 
(parameterMetadataJdbc30Test) so that they can never fail.

E.g.

assertSQLState("22019", e.getSQLState(), e);


The first argument is the message, the second the expected state. Here 
the SQL state from the exception itself is being passed as expected, and 
thus will be compared to itself and always pass. If no message is needed 
then the call should be:

assertSQLState("22019", e);

Dan.




Mime
View raw message