You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by hu...@apache.org on 2026/08/12 05:50:13 UTC

(shardingsphere) branch master updated: Fix released savepoint rollback assertion (#39419)

This is an automated email from the ASF dual-hosted git repository.

iamhucong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 072887f3376 Fix released savepoint rollback assertion (#39419)
072887f3376 is described below

commit 072887f337616422ca003f1e9929e78272979267
Author: ZhangCheng <ch...@apache.org>
AuthorDate: Wed Aug 12 13:50:05 2026 +0800

    Fix released savepoint rollback assertion (#39419)
---
 .../transaction/cases/savepoint/MySQLSavePointTestCase.java       | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/operation/transaction/cases/savepoint/MySQLSavePointTestCase.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/operation/transaction/cases/savepoint/MySQLSavePointTestCase.java
index 2c40f67e5a6..3aa5d5b10c8 100644
--- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/operation/transaction/cases/savepoint/MySQLSavePointTestCase.java
+++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/operation/transaction/cases/savepoint/MySQLSavePointTestCase.java
@@ -26,6 +26,7 @@ import java.sql.SQLException;
 
 import static org.hamcrest.Matchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 /**
  * MySQL savepoint transaction integration test.
@@ -51,11 +52,8 @@ public final class MySQLSavePointTestCase extends BaseSavePointTestCase {
             executeWithLog(connection, "INSERT INTO account(id, balance, transaction_id) VALUES(1,1,1)");
             executeWithLog(connection, "SAVEPOINT point1");
             executeWithLog(connection, "RELEASE SAVEPOINT point1");
-            try {
-                executeWithLog(connection, "ROLLBACK TO SAVEPOINT point1");
-            } catch (final SQLException ex) {
-                assertThat(ex.getMessage(), is("SAVEPOINT point1 does not exist"));
-            }
+            SQLException actualException = assertThrows(SQLException.class, () -> executeWithLog(connection, "ROLLBACK TO SAVEPOINT point1"));
+            assertThat(actualException.getMessage(), is("SAVEPOINT point1 does not exist"));
             connection.rollback();
         }
     }