@groovy.transform.CompileStatic @org.springframework.core.annotation.Order(value: Ordered.HIGHEST_PRECEDENCE) final class TestContextHolderListener extends java.lang.Object implements TestExecutionListener
A Spring TestExecutionListener that captures the current TestContext in a java.lang.ThreadLocal so that it can be accessed by the database cleanup framework during test execution.
This listener is auto-registered via META-INF/spring.factories.
It sets the TestContext before each test method. The java.lang.ThreadLocal is
cleared by the DatabaseCleanupInterceptor after database cleanup completes,
rather than in afterTestMethod, to ensure the context remains available
throughout the entire cleanup phase.
| Modifiers | Name | Description |
|---|---|---|
static java.lang.ThreadLocal<TestContext> |
CURRENT |
Holds the current TestContext for the executing test thread. |
| Constructor and description |
|---|
TestContextHolderListener() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
beforeTestMethod(TestContext testContext) |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
Holds the current TestContext for the executing test thread. Set before each test method by this listener and cleared by DatabaseCleanupInterceptor after cleanup completes.