public class MicronautJunit5Extension extends AbstractMicronautExtension<org.junit.jupiter.api.extension.ExtensionContext> 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.ExecutionCondition, org.junit.jupiter.api.extension.BeforeTestExecutionCallback, org.junit.jupiter.api.extension.AfterTestExecutionCallback, org.junit.jupiter.api.extension.ParameterResolver, org.junit.jupiter.api.extension.InvocationInterceptor
applicationContext, DISABLED_MESSAGE, embeddedApplication, MISCONFIGURED_MESSAGE, oldValues, refreshScope, specDefinition, TEST_PROPERTY_SOURCE, TEST_ROLLBACK, TEST_TRANSACTION_MODE, TEST_TRANSACTIONAL, testProperties
Constructor and Description |
---|
MicronautJunit5Extension() |
Modifier and Type | Method and Description |
---|---|
void |
afterAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext) |
void |
afterEach(org.junit.jupiter.api.extension.ExtensionContext extensionContext)
Executed after each test completes.
|
void |
afterTestExecution(org.junit.jupiter.api.extension.ExtensionContext context) |
protected void |
alignMocks(org.junit.jupiter.api.extension.ExtensionContext context,
java.lang.Object instance) |
void |
beforeAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext) |
void |
beforeEach(org.junit.jupiter.api.extension.ExtensionContext extensionContext) |
void |
beforeTestExecution(org.junit.jupiter.api.extension.ExtensionContext context) |
protected MicronautTestValue |
buildMicronautTestValue(java.lang.Class<?> testClass)
Builds a
MicronautTestValue object from the provided class (e.g. |
org.junit.jupiter.api.extension.ConditionEvaluationResult |
evaluateExecutionCondition(org.junit.jupiter.api.extension.ExtensionContext extensionContext) |
protected org.junit.jupiter.api.extension.ExtensionContext.Store |
getStore(org.junit.jupiter.api.extension.ExtensionContext context) |
protected boolean |
hasExpectedAnnotations(java.lang.Class<?> testClass) |
void |
interceptAfterEachMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<java.lang.Void> invocation,
org.junit.jupiter.api.extension.ReflectiveInvocationContext<java.lang.reflect.Method> invocationContext,
org.junit.jupiter.api.extension.ExtensionContext extensionContext) |
void |
interceptBeforeEachMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<java.lang.Void> invocation,
org.junit.jupiter.api.extension.ReflectiveInvocationContext<java.lang.reflect.Method> invocationContext,
org.junit.jupiter.api.extension.ExtensionContext extensionContext) |
java.lang.Object |
resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext,
org.junit.jupiter.api.extension.ExtensionContext extensionContext) |
protected void |
resolveTestProperties(org.junit.jupiter.api.extension.ExtensionContext context,
MicronautTestValue testAnnotationValue,
java.util.Map<java.lang.String,java.lang.Object> testProperties)
Resolves any test properties.
|
boolean |
supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext,
org.junit.jupiter.api.extension.ExtensionContext extensionContext) |
afterClass, afterCleanupTest, afterSetupTest, afterTestClass, afterTestExecution, afterTestMethod, beforeClass, beforeCleanupTest, beforeEach, beforeSetupTest, beforeTestClass, beforeTestExecution, beforeTestMethod, isTestSuiteBeanPresent, postProcessBuilder, startApplicationContext
public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws java.lang.Exception
beforeAll
in interface org.junit.jupiter.api.extension.BeforeAllCallback
java.lang.Exception
protected MicronautTestValue buildMicronautTestValue(java.lang.Class<?> testClass)
MicronautTestValue
object from the provided class (e.g. by scanning annotations).testClass
- the class to extract builder configuration frompublic void interceptBeforeEachMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<java.lang.Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<java.lang.reflect.Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws java.lang.Throwable
interceptBeforeEachMethod
in interface org.junit.jupiter.api.extension.InvocationInterceptor
java.lang.Throwable
public void interceptAfterEachMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<java.lang.Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<java.lang.reflect.Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws java.lang.Throwable
interceptAfterEachMethod
in interface org.junit.jupiter.api.extension.InvocationInterceptor
java.lang.Throwable
public void afterAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws java.lang.Exception
afterAll
in interface org.junit.jupiter.api.extension.AfterAllCallback
java.lang.Exception
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws java.lang.Exception
beforeEach
in interface org.junit.jupiter.api.extension.BeforeEachCallback
java.lang.Exception
public void afterEach(org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws java.lang.Exception
AbstractMicronautExtension
afterEach
in interface org.junit.jupiter.api.extension.AfterEachCallback
afterEach
in class AbstractMicronautExtension<org.junit.jupiter.api.extension.ExtensionContext>
extensionContext
- The contextjava.lang.Exception
- allows any exception to propagatepublic org.junit.jupiter.api.extension.ConditionEvaluationResult evaluateExecutionCondition(org.junit.jupiter.api.extension.ExtensionContext extensionContext)
evaluateExecutionCondition
in interface org.junit.jupiter.api.extension.ExecutionCondition
protected boolean hasExpectedAnnotations(java.lang.Class<?> testClass)
testClass
- the test classprotected void resolveTestProperties(org.junit.jupiter.api.extension.ExtensionContext context, MicronautTestValue testAnnotationValue, java.util.Map<java.lang.String,java.lang.Object> testProperties)
AbstractMicronautExtension
resolveTestProperties
in class AbstractMicronautExtension<org.junit.jupiter.api.extension.ExtensionContext>
context
- The test contexttestAnnotationValue
- The test annotationtestProperties
- The test propertiesprotected void alignMocks(org.junit.jupiter.api.extension.ExtensionContext context, java.lang.Object instance)
alignMocks
in class AbstractMicronautExtension<org.junit.jupiter.api.extension.ExtensionContext>
context
- The contextinstance
- The mock instance to injectpublic void afterTestExecution(org.junit.jupiter.api.extension.ExtensionContext context) throws java.lang.Exception
afterTestExecution
in interface org.junit.jupiter.api.extension.AfterTestExecutionCallback
java.lang.Exception
public void beforeTestExecution(org.junit.jupiter.api.extension.ExtensionContext context) throws java.lang.Exception
beforeTestExecution
in interface org.junit.jupiter.api.extension.BeforeTestExecutionCallback
java.lang.Exception
public boolean supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException
supportsParameter
in interface org.junit.jupiter.api.extension.ParameterResolver
org.junit.jupiter.api.extension.ParameterResolutionException
public java.lang.Object resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException
resolveParameter
in interface org.junit.jupiter.api.extension.ParameterResolver
org.junit.jupiter.api.extension.ParameterResolutionException
protected org.junit.jupiter.api.extension.ExtensionContext.Store getStore(org.junit.jupiter.api.extension.ExtensionContext context)
context
- the current extension context