Class RiftTestExecutionListener

java.lang.Object
org.springframework.test.context.support.AbstractTestExecutionListener
io.github.achirdlabs.rift.spring.RiftTestExecutionListener
All Implemented Interfaces:
org.springframework.core.Ordered, org.springframework.test.context.TestExecutionListener

public final class RiftTestExecutionListener extends org.springframework.test.context.support.AbstractTestExecutionListener
Injects InjectRift/InjectImposter fields and drives Reset between test methods/classes, using the RiftTestContext bean RiftContextCustomizer registers. Contexts without @EnableRift have no such bean and are left untouched.
  • Field Summary

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    beforeTestClass(org.springframework.test.context.TestContext testContext)
    Reads @EnableRift.reset() straight off the test class, rather than through the RiftTestContext bean, so a class not configured for Reset.PER_CLASS never forces the application context to load this early — before RiftSpringTestBase-style static initializers (e.g. publishing an admin URI system property) have had a chance to run.
    void
    beforeTestMethod(org.springframework.test.context.TestContext testContext)
     
    int
     
    void
    prepareTestInstance(org.springframework.test.context.TestContext testContext)
     

    Methods inherited from class org.springframework.test.context.support.AbstractTestExecutionListener

    afterTestClass, afterTestExecution, afterTestMethod, beforeTestExecution

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RiftTestExecutionListener

      public RiftTestExecutionListener()
  • Method Details

    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface org.springframework.core.Ordered
      Overrides:
      getOrder in class org.springframework.test.context.support.AbstractTestExecutionListener
    • prepareTestInstance

      public void prepareTestInstance(org.springframework.test.context.TestContext testContext)
      Specified by:
      prepareTestInstance in interface org.springframework.test.context.TestExecutionListener
      Overrides:
      prepareTestInstance in class org.springframework.test.context.support.AbstractTestExecutionListener
    • beforeTestMethod

      public void beforeTestMethod(org.springframework.test.context.TestContext testContext)
      Specified by:
      beforeTestMethod in interface org.springframework.test.context.TestExecutionListener
      Overrides:
      beforeTestMethod in class org.springframework.test.context.support.AbstractTestExecutionListener
    • beforeTestClass

      public void beforeTestClass(org.springframework.test.context.TestContext testContext)
      Reads @EnableRift.reset() straight off the test class, rather than through the RiftTestContext bean, so a class not configured for Reset.PER_CLASS never forces the application context to load this early — before RiftSpringTestBase-style static initializers (e.g. publishing an admin URI system property) have had a chance to run. When the class genuinely is Reset.PER_CLASS, the context load this triggers is still best-effort: a failure here is swallowed so it doesn't fail the class before a single test runs.
      Specified by:
      beforeTestClass in interface org.springframework.test.context.TestExecutionListener
      Overrides:
      beforeTestClass in class org.springframework.test.context.support.AbstractTestExecutionListener