Allow local @⁠BootstrapWith annotation to override a meta-annotation

This commit revises the resolveExplicitTestContextBootstrapper()
algorithm in BootstrapUtils to allow a local @⁠BootstrapWith annotation
to override a meta-annotation within the same composed annotation.

Closes gh-35938
This commit is contained in:
Sam Brannen
2026-03-13 15:24:38 +01:00
parent 32d1b83f62
commit 293a9c0ee3
2 changed files with 31 additions and 23 deletions
@@ -146,13 +146,7 @@ class BootstrapUtilsTests {
*/
@Test // gh-35938
void resolveTestContextBootstrapperWithMetaBootstrapWithAnnotationThatOverridesMetaMetaBootstrapWithAnnotation() {
BootstrapContext bootstrapContext = BootstrapTestUtils.buildBootstrapContext(
MetaAndMetaMetaBootstrapWithAnnotationsClass.class, delegate);
assertThatIllegalStateException()
.isThrownBy(() -> resolveTestContextBootstrapper(bootstrapContext))
.withMessageContaining("Configuration error: found multiple declarations of @BootstrapWith")
.withMessageContaining(FooBootstrapper.class.getSimpleName())
.withMessageContaining(BarBootstrapper.class.getSimpleName());
assertBootstrapper(MetaAndMetaMetaBootstrapWithAnnotationsClass.class, BarBootstrapper.class);
}
/**