Package io.micronaut.test.annotation
Class MicronautTestValue
java.lang.Object
io.micronaut.test.annotation.MicronautTestValue
Value object for the values from any of the MicronautTest annotations.
- Since:
- 2.1.0
- Author:
- Álvaro Sánchez-Mariscal
-
Constructor Summary
ConstructorDescriptionMicronautTestValue
(Class<?> application, String[] environments, String[] packages, String[] propertySources, boolean rollback, boolean transactional, boolean rebuildContext, Class<? extends io.micronaut.context.ApplicationContextBuilder>[] contextBuilder, TransactionMode transactionMode, boolean startApplication, boolean resolveParameters) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionClass<?>
Class<? extends io.micronaut.context.ApplicationContextBuilder>[]
The application context builder to use to construct the context.String[]
boolean
String[]
packages()
String[]
One or many references to classpath.boolean
Whether to rebuild the application context before each test method.boolean
rollback()
Whether to rollback (if possible) any data access code between each test execution.boolean
boolean
Allow disabling or enabling of automatic transaction wrapping.TheTransactionMode
.
-
Constructor Details
-
MicronautTestValue
@Creator public MicronautTestValue(Class<?> application, String[] environments, String[] packages, String[] propertySources, boolean rollback, boolean transactional, boolean rebuildContext, Class<? extends io.micronaut.context.ApplicationContextBuilder>[] contextBuilder, TransactionMode transactionMode, boolean startApplication, boolean resolveParameters) Default constructor.- Parameters:
application
- The application class of the applicationenvironments
- The environments to use.packages
- The packages to consider for scanning.propertySources
- The property sourcesrollback
- True if changes should be rolled backtransactional
- Whether to wrap a test in a transaction.rebuildContext
- true if the application context should be rebuilt for each test methodcontextBuilder
- The buildertransactionMode
- The transaction modestartApplication
- Whether the start the appresolveParameters
- Whether to resolve parameters to beans
-
-
Method Details
-
application
- Returns:
- The application class of the application
-
environments
- Returns:
- The environments to use.
-
packages
- Returns:
- The packages to consider for scanning.
-
propertySources
One or many references to classpath. For example: "classpath:mytest.yml"- Returns:
- The property sources
-
rollback
public boolean rollback()Whether to rollback (if possible) any data access code between each test execution.- Returns:
- True if changes should be rolled back
-
transactional
public boolean transactional()Allow disabling or enabling of automatic transaction wrapping.- Returns:
- Whether to wrap a test in a transaction.
-
rebuildContext
public boolean rebuildContext()Whether to rebuild the application context before each test method.- Returns:
- true if the application context should be rebuilt for each test method
-
contextBuilder
The application context builder to use to construct the context.- Returns:
- The builder
-
transactionMode
TheTransactionMode
.- Returns:
- The transaction mode
-
startApplication
public boolean startApplication()- Returns:
- Whether to start the embedded application
-
isResolveParameters
public boolean isResolveParameters()- Returns:
- Whether to resolve test method parameters.
-