Wednesday, June 12, 2002 06:20 AM
This is a happy path test case. In your test case function, first call this inserting row
method. This should have inserted a row into the database. Then do a select on it to make sure the row has actually been inserted. You can take it a step further and also delete that row. In that case, you should be able to run this test case method any number of times.
But please remember that JUnit is more useful when you test it for erroneous conditions. For example, how is the insert handled when you give it erroneous data, or if the database connection is down, or if no connection is available? What happens if some primary key / indexes are violated? Testing for the unhappy paths will make your test case more robust.