クラス WithSecurityContextTestExecutionListener
java.lang.ObjectSE
org.springframework.test.context.support.AbstractTestExecutionListener
org.springframework.security.test.context.support.WithSecurityContextTestExecutionListener
- 実装されたすべてのインターフェース:
org.springframework.core.Ordered
,org.springframework.test.context.TestExecutionListener
public class WithSecurityContextTestExecutionListener
extends org.springframework.test.context.support.AbstractTestExecutionListener
テストメソッドまたはクラスレベルで
WithSecurityContext
でアノテーションが付けられたアノテーションを検索する TestExecutionListener
。見つかった場合、WithSecurityContext.factory()
は、このテストで使用される SecurityContext
を作成するために使用されます。MockMvc
で使用する場合は、SecurityMockMvcRequestPostProcessors.testSecurityContext()
も使用する必要があります。フィールドサマリー
インターフェース org.springframework.core.Ordered から継承されたフィールド
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
コンストラクターのサマリー
コンストラクターメソッドのサマリー
修飾子と型メソッド説明void
afterTestMethod
(org.springframework.test.context.TestContext testContext) 各テストメソッドの後にTestSecurityContextHolder
とSecurityContextHolder
をクリアします。void
beforeTestExecution
(org.springframework.test.context.TestContext testContext) テスト実行前に構成されている場合、SecurityContext が設定されますvoid
beforeTestMethod
(org.springframework.test.context.TestContext testContext) テストメソッドごとにSecurityContext
を設定します。int
getOrder()
10000
を返します。クラス org.springframework.test.context.support.AbstractTestExecutionListener から継承されたメソッド
afterTestClass, afterTestExecution, beforeTestClass, prepareTestInstance
コンストラクターの詳細
WithSecurityContextTestExecutionListener
public WithSecurityContextTestExecutionListener()
メソッドの詳細
beforeTestMethod
public void beforeTestMethod(org.springframework.test.context.TestContext testContext) テストメソッドごとにSecurityContext
をセットアップします。まず、WithSecurityContext
を持つWithSecurityContext
またはAnnotation
SE の特定のメソッドがインスペクションされます。それが見つからない場合、クラスがインスペクションされます。それでも見つからない場合、SecurityContext
は取り込まれません。- 次で指定:
- インターフェース
org.springframework.test.context.TestExecutionListener
のbeforeTestMethod
- オーバーライド:
- クラス
org.springframework.test.context.support.AbstractTestExecutionListener
のbeforeTestMethod
beforeTestExecution
public void beforeTestExecution(org.springframework.test.context.TestContext testContext) テスト実行前に構成されている場合、SecurityContext が設定されます- 次で指定:
- インターフェース
org.springframework.test.context.TestExecutionListener
のbeforeTestExecution
- オーバーライド:
- クラス
org.springframework.test.context.support.AbstractTestExecutionListener
のbeforeTestExecution
- 導入:
- 5.1
afterTestMethod
public void afterTestMethod(org.springframework.test.context.TestContext testContext) 各テストメソッドの後にTestSecurityContextHolder
とSecurityContextHolder
をクリアします。- 次で指定:
- インターフェース
org.springframework.test.context.TestExecutionListener
のafterTestMethod
- オーバーライド:
- クラス
org.springframework.test.context.support.AbstractTestExecutionListener
のafterTestMethod
getOrder
public int getOrder()10000
を返します。- 次で指定:
- インターフェース
org.springframework.core.Ordered
のgetOrder
- オーバーライド:
- クラス
org.springframework.test.context.support.AbstractTestExecutionListener
のgetOrder