YongGoose commented on code in PR #7482:
URL: https://github.com/apache/incubator-seata/pull/7482#discussion_r2188085311


##########
spring/src/test/java/org/apache/seata/spring/kt/TransactionScopeTest.kt:
##########
@@ -72,63 +94,236 @@ class TransactionScopeTest {
                 return globalStatus
             }
         })
+        
+        // Clean up context
+        RootContext.unbind()
     }
 
+    /**
+     * Cleans up the test environment after each test method.
+     * 
+     * This method:
+     * - Unbinds any remaining transaction context
+     * - Restores the original TransactionManager
+     */
+    @AfterEach
+    fun tearDown() {
+        // Clean up global state to avoid affecting other tests
+        RootContext.unbind()

Review Comment:
   From the perspective of double protection, I think it's fine to have both 
applied.
   I gave it a bit more thought, and if we only annotate `@BeforeEach`, there's 
a chance that `RootContext.unbind` might not be called after the very last test.
   
   I'll leave it up to your judgment!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org
For additional commands, e-mail: notifications-h...@seata.apache.org

Reply via email to