mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Merge branch '2.4.x' into 2.5.x
Closes gh-28565
This commit is contained in:
commit
6406ee5609
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2021 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -222,6 +222,7 @@ class ImportsContextCustomizer implements ContextCustomizer {
|
|||||||
filters.add(new JavaLangAnnotationFilter());
|
filters.add(new JavaLangAnnotationFilter());
|
||||||
filters.add(new KotlinAnnotationFilter());
|
filters.add(new KotlinAnnotationFilter());
|
||||||
filters.add(new SpockAnnotationFilter());
|
filters.add(new SpockAnnotationFilter());
|
||||||
|
filters.add(new JunitAnnotationFilter());
|
||||||
ANNOTATION_FILTERS = Collections.unmodifiableSet(filters);
|
ANNOTATION_FILTERS = Collections.unmodifiableSet(filters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,4 +385,16 @@ class ImportsContextCustomizer implements ContextCustomizer {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link AnnotationFilter} for JUnit annotations.
|
||||||
|
*/
|
||||||
|
private static final class JunitAnnotationFilter implements AnnotationFilter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isIgnored(Annotation annotation) {
|
||||||
|
return annotation.annotationType().getName().startsWith("org.junit.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2021 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -22,6 +22,8 @@ import java.util.Collections;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import kotlin.Metadata;
|
import kotlin.Metadata;
|
||||||
|
import org.junit.jupiter.api.Nested;
|
||||||
|
import org.junit.jupiter.api.Tag;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.spockframework.runtime.model.SpecMetadata;
|
import org.spockframework.runtime.model.SpecMetadata;
|
||||||
import spock.lang.Issue;
|
import spock.lang.Issue;
|
||||||
@ -72,6 +74,12 @@ class ImportsContextCustomizerTests {
|
|||||||
.isEqualTo(new ImportsContextCustomizer(SecondSpockLangAnnotatedTestClass.class));
|
.isEqualTo(new ImportsContextCustomizer(SecondSpockLangAnnotatedTestClass.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void customizersForTestClassesWithDifferentJunitAnnotationsAreEqual() {
|
||||||
|
assertThat(new ImportsContextCustomizer(FirstJunitAnnotatedTestClass.class))
|
||||||
|
.isEqualTo(new ImportsContextCustomizer(SecondJunitAnnotatedTestClass.class));
|
||||||
|
}
|
||||||
|
|
||||||
@Import(TestImportSelector.class)
|
@Import(TestImportSelector.class)
|
||||||
@Indicator1
|
@Indicator1
|
||||||
static class FirstImportSelectorAnnotatedClass {
|
static class FirstImportSelectorAnnotatedClass {
|
||||||
@ -126,6 +134,18 @@ class ImportsContextCustomizerTests {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@Import(TestImportSelector.class)
|
||||||
|
static class FirstJunitAnnotatedTestClass {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Tag("test")
|
||||||
|
@Import(TestImportSelector.class)
|
||||||
|
static class SecondJunitAnnotatedTestClass {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@interface Indicator1 {
|
@interface Indicator1 {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user