Skip to content

Commit

Permalink
Merge branch '2.5.x'
Browse files Browse the repository at this point in the history
Closes gh-28566
  • Loading branch information
philwebb committed Nov 8, 2021
2 parents 5915161 + 6406ee5 commit 0a6991e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
Expand Up @@ -223,6 +223,7 @@ static class ContextCustomizerKey {
filters.add(new JavaLangAnnotationFilter());
filters.add(new KotlinAnnotationFilter());
filters.add(new SpockAnnotationFilter());
filters.add(new JunitAnnotationFilter());
ANNOTATION_FILTERS = Collections.unmodifiableSet(filters);
}

Expand Down Expand Up @@ -385,4 +386,16 @@ public boolean isIgnored(Annotation annotation) {

}

/**
* {@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");
* you may not use this file except in compliance with the License.
Expand All @@ -22,6 +22,8 @@
import java.util.Set;

import kotlin.Metadata;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.spockframework.runtime.model.SpecMetadata;
import spock.lang.Issue;
Expand Down Expand Up @@ -72,6 +74,12 @@ void customizersForTestClassesWithDifferentSpockLangAnnotationsAreEqual() {
.isEqualTo(new ImportsContextCustomizer(SecondSpockLangAnnotatedTestClass.class));
}

@Test
void customizersForTestClassesWithDifferentJunitAnnotationsAreEqual() {
assertThat(new ImportsContextCustomizer(FirstJunitAnnotatedTestClass.class))
.isEqualTo(new ImportsContextCustomizer(SecondJunitAnnotatedTestClass.class));
}

@Import(TestImportSelector.class)
@Indicator1
static class FirstImportSelectorAnnotatedClass {
Expand Down Expand Up @@ -126,6 +134,18 @@ static class SecondSpockLangAnnotatedTestClass {

}

@Nested
@Import(TestImportSelector.class)
static class FirstJunitAnnotatedTestClass {

}

@Tag("test")
@Import(TestImportSelector.class)
static class SecondJunitAnnotatedTestClass {

}

@Retention(RetentionPolicy.RUNTIME)
@interface Indicator1 {

Expand Down

0 comments on commit 0a6991e

Please sign in to comment.