Fork me on GitHub

I am trying to test a java.sql.SQLException handler which unwraps the exceptions like below. However I'm not sure how I would throw this exception in a test.

(-> e
           (.startsWith "ERROR: duplicate key value"))
current mock (`.getNextException` returns nil on this):
(throw (SQLException. "ERROR: duplicate key value"))


Ah thank you @seancorfield, looks like a BatchUpdateException is actually thrown before the duplicate key exception and that's why the .getNextException is needed.


That helped me understand how the transaction is run a bit better too.