    @Test
    public void testSQLExceptionUnwrap() {

        SQLTransactionRollbackException transactionRollbackException = new SQLTransactionRollbackException();
        SQLRecoverableException recoverableException = new SQLRecoverableException();
        SQLSyntaxErrorException syntaxErrorException = new SQLSyntaxErrorException();
        recoverableException.setNextException(syntaxErrorException);
        transactionRollbackException.setNextException(recoverableException);
        Throwable e = new Exception(transactionRollbackException);

        ExceptionStack es = new ExceptionStack(e);

        assertThat(es.getCauseElements().size(), is(4));
        assertThat(es.getCauseElements(), hasItems(e, transactionRollbackException, recoverableException, syntaxErrorException));
    }