use of org.springframework.boot.testsupport.gradle.testkit.GradleVersions in project spring-boot by spring-projects.
the class GradleCompatibilityExtension method provideTestTemplateInvocationContexts.
@Override
public Stream<TestTemplateInvocationContext> provideTestTemplateInvocationContexts(ExtensionContext context) {
Stream<String> gradleVersions = GRADLE_VERSIONS.stream();
GradleCompatibility gradleCompatibility = AnnotationUtils.findAnnotation(context.getRequiredTestClass(), GradleCompatibility.class).get();
if (StringUtils.hasText(gradleCompatibility.versionsLessThan())) {
GradleVersion upperExclusive = GradleVersion.version(gradleCompatibility.versionsLessThan());
gradleVersions = gradleVersions.filter((version) -> GradleVersion.version(version).compareTo(upperExclusive) < 0);
}
return gradleVersions.flatMap((version) -> {
List<TestTemplateInvocationContext> invocationContexts = new ArrayList<>();
invocationContexts.add(new GradleVersionTestTemplateInvocationContext(version, false));
boolean configurationCache = gradleCompatibility.configurationCache();
if (configurationCache) {
invocationContexts.add(new GradleVersionTestTemplateInvocationContext(version, true));
}
return invocationContexts.stream();
});
}
Aggregations