Annotation Interface ApplicationModuleTest
@Target(TYPE)
@Documented
@Inherited
@Retention(RUNTIME)
@SpringBootTest
@TypeExcludeFilters(ModuleTypeExcludeFilter.class)
@ImportAutoConfiguration(ModuleTestAutoConfiguration.class)
@ExtendWith({PublishedEventsParameterResolver.class,ScenarioParameterResolver.class})
@TestInstance(PER_CLASS)
@TestConstructor(autowireMode=ALL)
public @interface ApplicationModuleTest
Bootstraps the module containing the package of the test class annotated with
ApplicationModuleTest
. Will
apply the following modifications to the Spring Boot configuration:
- Restricts the component scanning to the module's package.
- Sets the module's package as the only auto-configuration and entity scan package.
- Author:
- Oliver Drotbohm
-
Nested Class Summary
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionClass<?>[]
Alias forSpringBootTest.classes()
.String[]
Module names of modules to be included in the test run independent of what themode()
defines.Logical name of the module to be bootstrapped in caseApplicationModuleTest
will be used outside a module packageboolean
Whether to automatically verify the module structure for validity.The type of web environment to create when applicable.
-
Element Details
-
value
- Default:
- STANDALONE
-
mode
- Default:
- STANDALONE
-
verifyAutomatically
boolean verifyAutomaticallyWhether to automatically verify the module structure for validity.- Returns:
- Default:
- true
-
extraIncludes
String[] extraIncludesModule names of modules to be included in the test run independent of what themode()
defines.- Returns:
- Default:
- {}
-
module
String moduleLogical name of the module to be bootstrapped in caseApplicationModuleTest
will be used outside a module package- Returns:
- will never be null.
- Since:
- 1.3
- Default:
- ""
-
classes
Alias forSpringBootTest.classes()
. Useful to define the main application class in case the test is located outside a module package and that class doesn't reside in any of the parent packages.- Returns:
- will never be null.
- Since:
- 1.3
- See Also:
- Default:
- {}
-
webEnvironment
@AliasFor(annotation=org.springframework.boot.test.context.SpringBootTest.class) SpringBootTest.WebEnvironment webEnvironmentThe type of web environment to create when applicable. Defaults toSpringBootTest.WebEnvironment.MOCK
.- Returns:
- the type of web environment
- Default:
- MOCK
-