类 AbstractDirtiesContextTestExecutionListener
java.lang.Object
cn.taketoday.test.context.support.AbstractTestExecutionListener
cn.taketoday.test.context.support.AbstractDirtiesContextTestExecutionListener
- 所有已实现的接口:
cn.taketoday.core.Ordered,TestExecutionListener
public abstract class AbstractDirtiesContextTestExecutionListener
extends AbstractTestExecutionListener
Abstract base class for
TestExecutionListener implementations that
provide support for marking the ApplicationContext associated with
a test as dirty for both test classes and test methods annotated
with the @DirtiesContext annotation.
The core functionality for this class was extracted from
DirtiesContextTestExecutionListener
- 从以下版本开始:
- 4.0
- 作者:
- Sam Brannen, Juergen Hoeller
- 另请参阅:
-
字段概要
字段从接口继承的字段 cn.taketoday.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected voidbeforeOrAfterTestClass(TestContext testContext, DirtiesContext.ClassMode requiredClassMode) Perform the actual work forAbstractTestExecutionListener.beforeTestClass(cn.taketoday.test.context.TestContext)andAbstractTestExecutionListener.afterTestClass(cn.taketoday.test.context.TestContext)by dirtying the context if appropriate (i.e., according to the required mode).protected voidbeforeOrAfterTestMethod(TestContext testContext, DirtiesContext.MethodMode requiredMethodMode, DirtiesContext.ClassMode requiredClassMode) Perform the actual work forAbstractTestExecutionListener.beforeTestMethod(cn.taketoday.test.context.TestContext)andAbstractTestExecutionListener.afterTestMethod(cn.taketoday.test.context.TestContext)by dirtying the context if appropriate (i.e., according to the required modes).protected voiddirtyContext(TestContext testContext, DirtiesContext.HierarchyMode hierarchyMode) Mark the application context of the supplied test context as dirty and setREINJECT_DEPENDENCIES_ATTRIBUTEin the test context totrue.abstract intgetOrder()The default implementation returnsOrdered.LOWEST_PRECEDENCE, thereby ensuring that custom listeners are ordered after default listeners supplied by the framework.从类继承的方法 cn.taketoday.test.context.support.AbstractTestExecutionListener
afterTestClass, afterTestExecution, afterTestMethod, beforeTestClass, beforeTestExecution, beforeTestMethod, prepareTestInstance
-
字段详细资料
-
logger
private static final cn.taketoday.logging.Logger logger
-
-
构造器详细资料
-
AbstractDirtiesContextTestExecutionListener
public AbstractDirtiesContextTestExecutionListener()
-
-
方法详细资料
-
getOrder
public abstract int getOrder()从类复制的说明:AbstractTestExecutionListenerThe default implementation returnsOrdered.LOWEST_PRECEDENCE, thereby ensuring that custom listeners are ordered after default listeners supplied by the framework. Can be overridden by subclasses as necessary.- 指定者:
getOrder在接口中cn.taketoday.core.Ordered- 覆盖:
getOrder在类中AbstractTestExecutionListener
-
dirtyContext
protected void dirtyContext(TestContext testContext, @Nullable DirtiesContext.HierarchyMode hierarchyMode) Mark the application context of the supplied test context as dirty and setREINJECT_DEPENDENCIES_ATTRIBUTEin the test context totrue.- 参数:
testContext- the test context whose application context should be marked as dirtyhierarchyMode- the context cache clearing mode to be applied if the context is part of a hierarchy; may benull- 从以下版本开始:
- 4.0
-
beforeOrAfterTestMethod
protected void beforeOrAfterTestMethod(TestContext testContext, DirtiesContext.MethodMode requiredMethodMode, DirtiesContext.ClassMode requiredClassMode) throws Exception Perform the actual work forAbstractTestExecutionListener.beforeTestMethod(cn.taketoday.test.context.TestContext)andAbstractTestExecutionListener.afterTestMethod(cn.taketoday.test.context.TestContext)by dirtying the context if appropriate (i.e., according to the required modes).- 参数:
testContext- the test context whose application context should potentially be marked as dirty; nevernullrequiredMethodMode- the method mode required for a context to be marked dirty in the current phase; nevernullrequiredClassMode- the class mode required for a context to be marked dirty in the current phase; nevernull- 抛出:
Exception- allows any exception to propagate- 从以下版本开始:
- 4.0
- 另请参阅:
-
beforeOrAfterTestClass
protected void beforeOrAfterTestClass(TestContext testContext, DirtiesContext.ClassMode requiredClassMode) throws Exception Perform the actual work forAbstractTestExecutionListener.beforeTestClass(cn.taketoday.test.context.TestContext)andAbstractTestExecutionListener.afterTestClass(cn.taketoday.test.context.TestContext)by dirtying the context if appropriate (i.e., according to the required mode).- 参数:
testContext- the test context whose application context should potentially be marked as dirty; nevernullrequiredClassMode- the class mode required for a context to be marked dirty in the current phase; nevernull- 抛出:
Exception- allows any exception to propagate- 从以下版本开始:
- 4.0
- 另请参阅:
-