Hi,
Going through the unreleased 0.02 tree, I noticed that the
MockSingleRowResultSet and MockMultiRowResultSet do not implement throwing
SQLExceptions in the same manner. Essentially, in the
MockSingleRowResultSet if you want a getXXX method to throw a SQLException,
you set the column value to the SQLException you want to throw and when you
call a getXXX on that column, the exception will be thrown. In
MockMultiRowResultSet, you have to call the setupThrowExceptionOnGet method,
and the first getXXX you call will throw the exception.
The implementation is not uniform (probably because it was implemented by
different developers), and leads to confusion.
IMHO, The MockSingleRowResultSet implementation is the most flexible in
terms of when an exception is thrown.
Another thing is that the MockSingleRowResultSet requires that all columns
in the ResultSet be accessed in order for it to pass the verify test. I'm
not sure this is a good idea as not all columns are accessed in a ResultSet
for a given query and shouldn't be required in order for it to pass.
I don't know the specs for these two classes so I don't know in what the
intended functionality are for these classes. Personally, I would prefer
the exception throwing implementation to be done in both the Single- and
Multi- RowResultSets... and that not all columns require to be "get"ted in
order for the ResultSet to pass the verify. Any thoughts?
Thanks,
Huy
|