db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject [JUnit] Should assertSQLState throw SQLException?
Date Tue, 22 Aug 2006 07:19:17 GMT
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.

Knut Anders

View raw message