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: Creating an Open cursor..
Date Tue, 07 Aug 2007 14:09:08 GMT
Ravinder Reddy Pandiri wrote:

>     assertUpdateCount(s , 0 , "create table t2(c21 int not null primary 
> key)");
>         assertUpdateCount(s , 1 , "insert into t2 values(21)");
>         assertUpdateCount(s , 1 , "insert into t2 values(22)");

On a separate issue I would avoid having asserts for every line of code 
in a test. Use asserts only for the actual elements that are being 
tested. In this case the create table and inserts are not really part of 
the test fixture, they are set up code.

This is to allow the tests to be easy to understand and to allow someone 
looking at the code later to instantly see what the focus of the test 
fixture is. E.g. if there are three lines with assert code then it's 
obvious that's the focus of the test fixture. If those three lines are 
hidden within ten other asserts that assert any setup up or cleanup code 
then it becomes less obvious what is going on.

The correct update count from an INSERT or a CREATE TABLE should only be 
in the text class & fixtures that are explicitly testing INSERT or 
CREATE TABLE.

Dan.



Mime
View raw message