Annotation Interface MicronautLambdaTest
@Retention(RUNTIME)
@Target({METHOD,ANNOTATION_TYPE,TYPE})
@ExtendWith(MicronautLambdaJunit5Extension.class)
@Factory
@Inherited
@Requires(condition=io.micronaut.test.condition.TestActiveCondition.class)
public @interface MicronautLambdaTest
Annotation that can be applied to any JUnit 5 test to enable testing
AWS Lambda handlers with a pre-configured ApplicationContext. Based on
MicronautTest
and supports the same options.- Since:
- 2.3.0
- Author:
- ttzn
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionClass<?>
Class<? extends io.micronaut.context.ApplicationContextBuilder>[]
The application context builder to use to construct the context.String[]
String[]
String[]
One or many references to classpath.boolean
Whether to rebuild the application context before each test method.boolean
By default, with JUnit 5 the test method parameters will be resolved to beans if possible.boolean
Whether to rollback (if possible) any data access code between each test execution.boolean
Whether to startEmbeddedApplication
.boolean
Allow disabling or enabling of automatic transaction wrapping.io.micronaut.test.annotation.TransactionMode
The transaction mode describing how transactions should be handled for each test.
-
Element Details
-
application
Class<?> application- Returns:
- The application class of the application
- Default:
- void.class
-
environments
String[] environments- Returns:
- The environments to use.
- Default:
- {}
-
packages
String[] packages- Returns:
- The packages to consider for scanning.
- Default:
- {}
-
propertySources
String[] propertySourcesOne or many references to classpath. For example: "classpath:mytest.yml"- Returns:
- The property sources
- Default:
- {}
-
rollback
boolean rollbackWhether to rollback (if possible) any data access code between each test execution.- Returns:
- True if changes should be rolled back
- Default:
- true
-
transactional
boolean transactionalAllow disabling or enabling of automatic transaction wrapping.- Returns:
- Whether to wrap a test in a transaction.
- Default:
- true
-
rebuildContext
boolean rebuildContextWhether to rebuild the application context before each test method.- Returns:
- true if the application context should be rebuilt for each test method
- Default:
- false
-
contextBuilder
Class<? extends io.micronaut.context.ApplicationContextBuilder>[] contextBuilderThe application context builder to use to construct the context. Note that some builder methods may be called to set Lambda-specific configuration (e.g. eager initialization and additional environments).- Returns:
- The builder
- Default:
- {}
-
transactionMode
io.micronaut.test.annotation.TransactionMode transactionModeThe transaction mode describing how transactions should be handled for each test.- Returns:
- The transaction mode
- Default:
- SEPARATE_TRANSACTIONS
-
startApplication
boolean startApplicationWhether to start
EmbeddedApplication
.When false, only the application context will be started. This can be used to disable
EmbeddedServer
.- Returns:
- true if
EmbeddedApplication
should be started
- Default:
- true
-
resolveParameters
boolean resolveParametersBy default, with JUnit 5 the test method parameters will be resolved to beans if possible. This behaviour can be problematic if in combination with theParameterizedTest
annotation. Setting this member tofalse
will completely disable bean resolution for method parameters.- Returns:
- Whether to resolve test method parameters as beans.
- Default:
- true
-