Class ChainedExtension

java.lang.Object
fr.ght1pc9kc.testy.core.extensions.ChainedExtension
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.BeforeEachCallback, org.junit.jupiter.api.extension.Extension, org.junit.jupiter.api.extension.ParameterResolver

public final class ChainedExtension extends Object implements org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.ParameterResolver
Allow to given an order to the Registered extensions.

In this example, WithEntityMongoClient need that before method of WithObjectMapper and WithEmbeddedMongo was invoked before its before method.

     private static WithEmbeddedMongo wMongo = WithEmbeddedMongo.builder().build();

     private static WithObjectMapper wMapper = WithObjectMapper.builder()
             .addMixin(Entity.class, EntityJacksonMixin.class)
             .build();

     private static WithEntityMongoClient wEntity = WithEntityMongoClient.builder()
             .setEmbeddedMongoExtension(wMongo)
             .setObjectMapperExtension(wMapper)
             .build();

     @RegisterExtension
     static ChainedExtension wChained = ChainedExtension
             .outer(wMapper)
             .append(wMongo)
             .append(wEntity)
             .register();
 
  • Method Details

    • 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
    • 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
    • beforeEach

      public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception
      Specified by:
      beforeEach in interface org.junit.jupiter.api.extension.BeforeEachCallback
      Throws:
      Exception
    • 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
    • supportsParameter

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

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

      public static ChainedExtension.ChainedExtensionBuilder outer(org.junit.jupiter.api.extension.Extension ex)