db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <Richard.Hille...@Sun.COM>
Subject Re: [JUnit] Should assertSQLState throw SQLException?
Date Tue, 22 Aug 2006 14:25:11 GMT
Alternatively, we could print out the stack trace ourselves. The logic 
to do this could be re-usable by a general-purpose assertEquals() 
overload which compares two Throwables. Failing by calling 
assertEquals() seems like the way the JUnit wants to track errors.

Regards,
-Rick

Knut Anders Hatlen wrote:

>Currently, BaseJDBCTestCase.assertSQLState() and JDBC.assertSQLState()
>basically do an assertEquals() on the SQL state. If the SQL state
>doesn't match the expected value, an AssertionFailure is raised, but
>the original exception is thrown away.
>
>Should we instead do something like this
>  if (!expected.equals(sqle.getSQLState())) throw sqle;
>?
>
>This way, we preserve the stack trace and the error message, not only
>the SQL state.
>
>  
>


Mime
View raw message