Class SystemStubsExtension

java.lang.Object
uk.org.webcompere.systemstubs.jupiter.SystemStubsExtension
All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.Extension, org.junit.jupiter.api.extension.ParameterResolver, org.junit.jupiter.api.extension.TestInstancePostProcessor, org.junit.jupiter.api.extension.TestInstancePreDestroyCallback

public class SystemStubsExtension extends Object implements org.junit.jupiter.api.extension.TestInstancePostProcessor, org.junit.jupiter.api.extension.TestInstancePreDestroyCallback, org.junit.jupiter.api.extension.ParameterResolver, org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.AfterAllCallback
Use with ExtendWith to add automatic processing of TestResource objects provided by System Stubs. Parameters to functions will be injected as live test resources, and fields marked as SystemStub will be active during the test and cleaned up automatically after.
Since:
1.0.0
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    afterAll(org.junit.jupiter.api.extension.ExtensionContext context)
     
    void
    afterEach(org.junit.jupiter.api.extension.ExtensionContext context)
     
    void
    beforeAll(org.junit.jupiter.api.extension.ExtensionContext context)
     
    void
    postProcessTestInstance(Object testInstance, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
     
    void
    preDestroyTestInstance(org.junit.jupiter.api.extension.ExtensionContext extensionContext)
     
    resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
     
    boolean
    supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
     

    Methods inherited from class java.lang.Object

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

    • SystemStubsExtension

      public SystemStubsExtension()
  • Method Details

    • postProcessTestInstance

      public void postProcessTestInstance(Object testInstance, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Exception
      Specified by:
      postProcessTestInstance in interface org.junit.jupiter.api.extension.TestInstancePostProcessor
      Throws:
      Exception
    • preDestroyTestInstance

      public void preDestroyTestInstance(org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Exception
      Specified by:
      preDestroyTestInstance in interface org.junit.jupiter.api.extension.TestInstancePreDestroyCallback
      Throws:
      Exception
    • supportsParameter

      public boolean supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException
      Specified by:
      supportsParameter in interface org.junit.jupiter.api.extension.ParameterResolver
      Throws:
      org.junit.jupiter.api.extension.ParameterResolutionException
    • resolveParameter

      public Object resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException
      Specified by:
      resolveParameter in interface org.junit.jupiter.api.extension.ParameterResolver
      Throws:
      org.junit.jupiter.api.extension.ParameterResolutionException
    • afterEach

      public void afterEach(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception
      Specified by:
      afterEach in interface org.junit.jupiter.api.extension.AfterEachCallback
      Throws:
      Exception
    • afterAll

      public void afterAll(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception
      Specified by:
      afterAll in interface org.junit.jupiter.api.extension.AfterAllCallback
      Throws:
      Exception
    • beforeAll

      public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception
      Specified by:
      beforeAll in interface org.junit.jupiter.api.extension.BeforeAllCallback
      Throws:
      Exception