public class ApplicationEventsTestExecutionListener extends AbstractTestExecutionListener
ApplicationEvents
のサポートを提供する TestExecutionListener
。 このリスナーは、テスト実行ライフサイクル内のさまざまなポイントで現在のスレッドの ApplicationEvents
の登録を管理し、テストクラスの @Autowired
フィールドを介して ApplicationEvents
の現在のインスタンスをテストで使用できるようにします。
テストクラスに @RecordApplicationEvents
でアノテーションが付けられていないか、メタアノテーションが付けられていない場合、このリスナーは実質的に何も行いません。
ApplicationEvents
, ApplicationEventsHolder
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
コンストラクターと説明 |
---|
ApplicationEventsTestExecutionListener() |
修飾子と型 | メソッドと説明 |
---|---|
void | afterTestMethod(TestContext testContext) デフォルトの実装は空です。 |
void | beforeTestMethod(TestContext testContext) デフォルトの実装は空です。 |
int | getOrder() 1800 を返します。 |
void | prepareTestInstance(TestContext testContext) デフォルトの実装は空です。 |
afterTestClass, afterTestExecution, beforeTestClass, beforeTestExecution
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
public final int getOrder()
1800
を返します。Ordered
の getOrder
AbstractTestExecutionListener
の getOrder
Ordered.HIGHEST_PRECEDENCE
, Ordered.LOWEST_PRECEDENCE
public void prepareTestInstance(TestContext testContext) throws ExceptionSE
AbstractTestExecutionListener
TestExecutionListener
の prepareTestInstance
AbstractTestExecutionListener
の prepareTestInstance
testContext
- テストのテストコンテキスト。null
ExceptionSE
- 例外の伝播を許可します public void beforeTestMethod(TestContext testContext) throws ExceptionSE
AbstractTestExecutionListener
TestExecutionListener
の beforeTestMethod
AbstractTestExecutionListener
の beforeTestMethod
testContext
- テストメソッドが実行されるテストコンテキスト。非 null
ExceptionSE
- 例外の伝播を許可します TestExecutionListener.afterTestMethod(org.springframework.test.context.TestContext)
, TestExecutionListener.beforeTestExecution(org.springframework.test.context.TestContext)
, TestExecutionListener.afterTestExecution(org.springframework.test.context.TestContext)
public void afterTestMethod(TestContext testContext) throws ExceptionSE
AbstractTestExecutionListener
TestExecutionListener
の afterTestMethod
AbstractTestExecutionListener
の afterTestMethod
testContext
- テストメソッドが実行されたテストコンテキスト ; 決して null
ExceptionSE
- 例外の伝播を許可します TestExecutionListener.beforeTestMethod(org.springframework.test.context.TestContext)
, TestExecutionListener.beforeTestExecution(org.springframework.test.context.TestContext)
, TestExecutionListener.afterTestExecution(org.springframework.test.context.TestContext)