-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Open
Labels
in: testIssues in the test moduleIssues in the test modulestatus: waiting-for-feedbackWe need additional information before we can continueWe need additional information before we can continuestatus: waiting-for-triageAn issue we've not yet triaged or decided onAn issue we've not yet triaged or decided on
Description
The Javadoc of BoostrapWith currently states:
This annotation may also be used as a meta-annotation to create custom composed annotations. Note, however, that a locally declared @BootstrapWith annotation (i.e., one that is directly present on the current test class) will override any meta-present declarations of @BootstrapWith.
However, if one tries to declare an annotation at class level that override a declaration that is meta-annotated, this leads to:
Suppressed: java.lang.IllegalStateException: Configuration error: found multiple declarations of @BootstrapWith for test class [com.example.demo.DemoCustomTestBootstrapApplicationTests]: [@org.springframework.test.context.BootstrapWith(value=com.example.demo.CustomTestContextBootstrapper.class), @org.springframework.test.context.BootstrapWith(value=org.springframework.boot.test.context.SpringBootTestContextBootstrapper.class)]
at org.springframework.test.context.BootstrapUtils.resolveExplicitTestContextBootstrapper(BootstrapUtils.java:193)
at org.springframework.test.context.BootstrapUtils.resolveTestContextBootstrapper(BootstrapUtils.java:150)
at org.springframework.test.context.BootstrapUtils.resolveTestContextBootstrapper(BootstrapUtils.java:126)
at org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:126)
at java.base/java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1916)
at org.springframework.test.context.junit.jupiter.SpringExtension.getTestContextManager(SpringExtension.java:427)
at org.springframework.test.context.junit.jupiter.SpringExtension.afterAll(SpringExtension.java:181)
With the following declaration:
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@SpringBootTest
@BootstrapWith(CustomTestContextBootstrapper.class)
public @interface CustomTest {
}I am not sure if the Javadoc is wrong or if the use case above is meant to be supported. Knowing that will help figure out our options for spring-projects/spring-boot#15077.
Metadata
Metadata
Assignees
Labels
in: testIssues in the test moduleIssues in the test modulestatus: waiting-for-feedbackWe need additional information before we can continueWe need additional information before we can continuestatus: waiting-for-triageAn issue we've not yet triaged or decided onAn issue we've not yet triaged or decided on