diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java index 2b32b96f05..b77a7dffb9 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java @@ -401,8 +401,8 @@ class ImportsContextCustomizer implements ContextCustomizer { @Override public boolean isIgnored(Annotation annotation) { - return annotation.annotationType().getName() - .startsWith("org.spockframework."); + return annotation.annotationType().getName().startsWith("org.spockframework.") + || annotation.annotationType().getName().startsWith("spock."); } } diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerTests.java index bbbd7c5028..e354c62ae0 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerTests.java @@ -24,6 +24,8 @@ import java.util.Set; import kotlin.Metadata; import org.junit.Test; import org.spockframework.runtime.model.SpecMetadata; +import spock.lang.Issue; +import spock.lang.Stepwise; import org.springframework.boot.context.annotation.DeterminableImports; import org.springframework.context.annotation.Configuration; @@ -63,10 +65,18 @@ public class ImportsContextCustomizerTests { } @Test - public void customizersForTestClassesWithDifferentSpockMetadataAreEqual() { - assertThat(new ImportsContextCustomizer(FirstSpockAnnotatedTestClass.class)) + public void customizersForTestClassesWithDifferentSpockFrameworkAnnotationsAreEqual() { + assertThat( + new ImportsContextCustomizer(FirstSpockFrameworkAnnotatedTestClass.class)) + .isEqualTo(new ImportsContextCustomizer( + SecondSpockFrameworkAnnotatedTestClass.class)); + } + + @Test + public void customizersForTestClassesWithDifferentSpockLangAnnotationsAreEqual() { + assertThat(new ImportsContextCustomizer(FirstSpockLangAnnotatedTestClass.class)) .isEqualTo(new ImportsContextCustomizer( - SecondSpockAnnotatedTestClass.class)); + SecondSpockLangAnnotatedTestClass.class)); } @Import(TestImportSelector.class) @@ -104,12 +114,22 @@ public class ImportsContextCustomizerTests { } @SpecMetadata(filename = "foo", line = 10) - static class FirstSpockAnnotatedTestClass { + static class FirstSpockFrameworkAnnotatedTestClass { } @SpecMetadata(filename = "bar", line = 10) - static class SecondSpockAnnotatedTestClass { + static class SecondSpockFrameworkAnnotatedTestClass { + + } + + @Stepwise + static class FirstSpockLangAnnotatedTestClass { + + } + + @Issue("1234") + static class SecondSpockLangAnnotatedTestClass { }