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();
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
beforeEach
(org.junit.jupiter.api.extension.ExtensionContext context) outer
(org.junit.jupiter.api.extension.Extension ex) 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)
-
Method Details
-
beforeAll
- Specified by:
beforeAll
in interfaceorg.junit.jupiter.api.extension.BeforeAllCallback
- Throws:
Exception
-
afterAll
- Specified by:
afterAll
in interfaceorg.junit.jupiter.api.extension.AfterAllCallback
- Throws:
Exception
-
beforeEach
- Specified by:
beforeEach
in interfaceorg.junit.jupiter.api.extension.BeforeEachCallback
- Throws:
Exception
-
afterEach
- Specified by:
afterEach
in interfaceorg.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 interfaceorg.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 interfaceorg.junit.jupiter.api.extension.ParameterResolver
-
outer
public static ChainedExtension.ChainedExtensionBuilder outer(org.junit.jupiter.api.extension.Extension ex)
-