Skip to content

Commit 51e7c2e

Browse files
committed
Merge pull request #8252 from Erling Holmqvist
* gh-8252: Polish "Ignore spock.lang annotations when creating test context cache key" Ignore spock.lang annotations when creating test context cache key
2 parents 47a59a9 + 98cf35d commit 51e7c2e

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -324,8 +324,8 @@ private static final class SpockAnnotationFilter implements AnnotationFilter {
324324

325325
@Override
326326
public boolean isIgnored(Annotation annotation) {
327-
return annotation.annotationType().getName()
328-
.startsWith("org.spockframework.");
327+
return annotation.annotationType().getName().startsWith("org.spockframework.")
328+
|| annotation.annotationType().getName().startsWith("spock.");
329329
}
330330

331331
}

spring-boot-test/src/test/java/org/springframework/boot/test/context/ImportsContextCustomizerTests.java

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,6 +19,8 @@
1919
import kotlin.Metadata;
2020
import org.junit.Test;
2121
import org.spockframework.runtime.model.SpecMetadata;
22+
import spock.lang.Issue;
23+
import spock.lang.Stepwise;
2224

2325
import static org.assertj.core.api.Assertions.assertThat;
2426

@@ -37,10 +39,18 @@ public void customizersForTestClassesWithDifferentKotlinMetadataAreEqual() {
3739
}
3840

3941
@Test
40-
public void customizersForTestClassesWithDifferentSpockMetadataAreEqual() {
41-
assertThat(new ImportsContextCustomizer(FirstSpockAnnotatedTestClass.class))
42+
public void customizersForTestClassesWithDifferentSpockFrameworkAnnotationsAreEqual() {
43+
assertThat(
44+
new ImportsContextCustomizer(FirstSpockFrameworkAnnotatedTestClass.class))
45+
.isEqualTo(new ImportsContextCustomizer(
46+
SecondSpockFrameworkAnnotatedTestClass.class));
47+
}
48+
49+
@Test
50+
public void customizersForTestClassesWithDifferentSpockLangAnnotationsAreEqual() {
51+
assertThat(new ImportsContextCustomizer(FirstSpockLangAnnotatedTestClass.class))
4252
.isEqualTo(new ImportsContextCustomizer(
43-
SecondSpockAnnotatedTestClass.class));
53+
SecondSpockLangAnnotatedTestClass.class));
4454
}
4555

4656
@Metadata(d2 = "foo")
@@ -54,12 +64,22 @@ static class SecondKotlinAnnotatedTestClass {
5464
}
5565

5666
@SpecMetadata(filename = "foo", line = 10)
57-
static class FirstSpockAnnotatedTestClass {
67+
static class FirstSpockFrameworkAnnotatedTestClass {
5868

5969
}
6070

6171
@SpecMetadata(filename = "bar", line = 10)
62-
static class SecondSpockAnnotatedTestClass {
72+
static class SecondSpockFrameworkAnnotatedTestClass {
73+
74+
}
75+
76+
@Stepwise
77+
static class FirstSpockLangAnnotatedTestClass {
78+
79+
}
80+
81+
@Issue("1234")
82+
static class SecondSpockLangAnnotatedTestClass {
6383

6484
}
6585

0 commit comments

Comments
 (0)