Interface CustomExtension

All Known Implementing Classes:
TestContainerExtension

public interface CustomExtension
An extension that is invoked before/after all/each tests, depending on whether it is wrapped in a EachCallbackWrapper or AllCallbackWrapper.

before method will be called in beforeEach or beforeAll. after will be called in afterEach or afterAll.

Usage example:


 public class Test{
      CustomExtension eachCustom = new CustomExtensionImpl1();
      CustomExtension allCustom = new CustomExtensionImpl2();
      @RegisterExtension
      static AllCallbackWrapper allWrapper = new AllCallbackWrapper(allCustom);
      @RegisterExtension
      EachCallbackWrapper eachWrapper = new EachCallbackWrapper(eachCustom);
 }
 

A CustomExtension instance must not be wrapped in both AllCallbackWrapper and EachCallbackWrapper for the same test class.

  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    after(org.junit.jupiter.api.extension.ExtensionContext context)
     
    default void
    before(org.junit.jupiter.api.extension.ExtensionContext context)
     
  • Method Details

    • before

      default void before(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception
      Throws:
      Exception
    • after

      default void after(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception
      Throws:
      Exception