public abstract class AbstractDirtiesContextTestExecutionListener extends AbstractTestExecutionListener
ApplicationContext
を、@DirtiesContext
アノテーションが付けられたテストクラスとテストメソッドの両方にダーティとしてマークするためのサポートを提供する TestExecutionListener
実装の抽象基本クラス。 このクラスのコア機能は、Spring Framework 4.2 の DirtiesContextTestExecutionListener
から抽出されました。
DirtiesContext
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
コンストラクターと説明 |
---|
AbstractDirtiesContextTestExecutionListener() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
afterTestClass, afterTestExecution, afterTestMethod, beforeTestClass, beforeTestExecution, beforeTestMethod, prepareTestInstance
public AbstractDirtiesContextTestExecutionListener()
public abstract int getOrder()
AbstractTestExecutionListener
Ordered.LOWEST_PRECEDENCE
を返すため、フレームワークによって提供されるデフォルトのリスナーの後にカスタムリスナーが確実に順序付けされます。必要に応じて、サブクラスでオーバーライドできます。Ordered
の getOrder
AbstractTestExecutionListener
の getOrder
Ordered.HIGHEST_PRECEDENCE
, Ordered.LOWEST_PRECEDENCE
protected void dirtyContext(TestContext testContext, @Nullable DirtiesContext.HierarchyMode hierarchyMode)
REINJECT_DEPENDENCIES_ATTRIBUTE
を true
に設定します。testContext
- アプリケーションコンテキストをダーティとしてマークする必要があるテストコンテキスト hierarchyMode
- コンテキストが階層の一部である場合に適用されるコンテキストキャッシュのクリアモード。null
の可能性があります protected void beforeOrAfterTestMethod(TestContext testContext, DirtiesContext.MethodMode requiredMethodMode, DirtiesContext.ClassMode requiredClassMode) throws java.lang.Exception
TestExecutionListener.beforeTestMethod(org.springframework.test.context.TestContext)
および TestExecutionListener.afterTestMethod(org.springframework.test.context.TestContext)
の実際の作業を実行します。testContext
- アプリケーションコンテキストがダーティとしてマークされる可能性があるテストコンテキスト。null
requiredMethodMode
- 現在のフェーズでコンテキストがダーティとマークされるために必要なメソッドモード。null
requiredClassMode
- 現在のフェーズでコンテキストがダーティとマークされるために必要なクラスモード。null
java.lang.Exception
- 例外の伝播を許可します dirtyContext(org.springframework.test.context.TestContext, org.springframework.test.annotation.DirtiesContext.HierarchyMode)
protected void beforeOrAfterTestClass(TestContext testContext, DirtiesContext.ClassMode requiredClassMode) throws java.lang.Exception
TestExecutionListener.beforeTestClass(org.springframework.test.context.TestContext)
および TestExecutionListener.afterTestClass(org.springframework.test.context.TestContext)
の実際の作業を実行します。testContext
- アプリケーションコンテキストがダーティとしてマークされる可能性があるテストコンテキスト。null
requiredClassMode
- 現在のフェーズでコンテキストがダーティとマークされるために必要なクラスモード。null
java.lang.Exception
- 例外の伝播を許可します dirtyContext(org.springframework.test.context.TestContext, org.springframework.test.annotation.DirtiesContext.HierarchyMode)