@Test
public void testRollbackWithException() throws Exception {

    try {
        Transaction.execute(new TransactionCallbackWithException<Object, FileNotFoundException>() {
            @Override
            public Object doInTransaction(TransactionStatus status) throws FileNotFoundException {
                assertEquals(TransactionLegacy.CLOUD_DB, TransactionLegacy.currentTxn().getDatabaseId().shortValue());
                throw new FileNotFoundException("Panic!");
            }
        });
        fail();
    } catch (FileNotFoundException e) {
        assertEquals("Panic!", e.getMessage());
    }
    verify(conn).setAutoCommit(false);
    verify(conn, times(0)).commit();
    verify(conn, times(1)).rollback();
    verify(conn, times(1)).close();
}