クラス WithSecurityContextTestExecutionListener

java.lang.ObjectSE
org.springframework.test.context.support.AbstractTestExecutionListener
org.springframework.security.test.context.support.WithSecurityContextTestExecutionListener
実装されたすべてのインターフェース:
org.springframework.core.Orderedorg.springframework.test.context.TestExecutionListener

public class WithSecurityContextTestExecutionListener extends org.springframework.test.context.support.AbstractTestExecutionListener
テストメソッドまたはクラスレベルで WithSecurityContext でアノテーションが付けられたアノテーションを検索する TestExecutionListener。見つかった場合、WithSecurityContext.factory() は、このテストで使用される SecurityContext を作成するために使用されます。MockMvc で使用する場合は、SecurityMockMvcRequestPostProcessors.testSecurityContext() も使用する必要があります。
導入:
4.0
関連事項:
  • フィールドサマリー

    インターフェース org.springframework.core.Ordered から継承されたフィールド

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • コンストラクターのサマリー

    コンストラクター
    コンストラクター
    説明
  • メソッドのサマリー

    修飾子と型
    メソッド
    説明
    void
    afterTestMethod(org.springframework.test.context.TestContext testContext)
    各テストメソッドの後に TestSecurityContextHolderSecurityContextHolder をクリアします。
    void
    beforeTestExecution(org.springframework.test.context.TestContext testContext)
    テスト実行前に構成されている場合、SecurityContext が設定されます
    void
    beforeTestMethod(org.springframework.test.context.TestContext testContext)
    テストメソッドごとに SecurityContext を設定します。
    int
    10000 を返します。

    クラス org.springframework.test.context.support.AbstractTestExecutionListener から継承されたメソッド

    afterTestClass, afterTestExecution, beforeTestClass, prepareTestInstance

    クラス java.lang.ObjectSE から継承されたメソッド

    clone, equalsSE, finalize, getClass, hashCode, notify, notifyAll, toString, wait, waitSE, waitSE
  • コンストラクターの詳細

    • WithSecurityContextTestExecutionListener

      public WithSecurityContextTestExecutionListener()
  • メソッドの詳細

    • beforeTestMethod

      public void beforeTestMethod(org.springframework.test.context.TestContext testContext)
      テストメソッドごとに SecurityContext をセットアップします。まず、WithSecurityContext を持つ WithSecurityContext または AnnotationSE の特定のメソッドがインスペクションされます。それが見つからない場合、クラスがインスペクションされます。それでも見つからない場合、SecurityContext は取り込まれません。
      次で指定:
      インターフェース org.springframework.test.context.TestExecutionListenerbeforeTestMethod 
      オーバーライド:
      クラス org.springframework.test.context.support.AbstractTestExecutionListenerbeforeTestMethod 
    • beforeTestExecution

      public void beforeTestExecution(org.springframework.test.context.TestContext testContext)
      テスト実行前に構成されている場合、SecurityContext が設定されます
      次で指定:
      インターフェース org.springframework.test.context.TestExecutionListenerbeforeTestExecution 
      オーバーライド:
      クラス org.springframework.test.context.support.AbstractTestExecutionListenerbeforeTestExecution 
      導入:
      5.1
    • afterTestMethod

      public void afterTestMethod(org.springframework.test.context.TestContext testContext)
      各テストメソッドの後に TestSecurityContextHolderSecurityContextHolder をクリアします。
      次で指定:
      インターフェース org.springframework.test.context.TestExecutionListenerafterTestMethod 
      オーバーライド:
      クラス org.springframework.test.context.support.AbstractTestExecutionListenerafterTestMethod 
    • getOrder

      public int getOrder()
      10000 を返します。
      次で指定:
      インターフェース org.springframework.core.OrderedgetOrder 
      オーバーライド:
      クラス org.springframework.test.context.support.AbstractTestExecutionListenergetOrder