Increase test coverage on Java 16
See gh-25809
This commit is contained in:
committed by
Andy Wilkinson
parent
96be3c2cea
commit
a9a37f0dd5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 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.
|
||||
@@ -19,6 +19,8 @@ package org.springframework.boot.gradle.docs;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.junit.jupiter.api.TestTemplate;
|
||||
import org.junit.jupiter.api.condition.DisabledForJreRange;
|
||||
import org.junit.jupiter.api.condition.JRE;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.gradle.junit.GradleMultiDslExtension;
|
||||
@@ -37,6 +39,7 @@ class PublishingDocumentationTests {
|
||||
|
||||
GradleBuild gradleBuild;
|
||||
|
||||
@DisabledForJreRange(min = JRE.JAVA_16)
|
||||
@TestTemplate
|
||||
void mavenUpload() throws IOException {
|
||||
assertThat(this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("5.6")
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.gradle.api.JavaVersion;
|
||||
import org.gradle.util.GradleVersion;
|
||||
import org.junit.jupiter.api.TestTemplate;
|
||||
import org.junit.jupiter.api.extension.Extension;
|
||||
@@ -42,8 +43,17 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
final class GradleCompatibilityExtension implements TestTemplateInvocationContextProvider {
|
||||
|
||||
private static final List<String> GRADLE_VERSIONS = Arrays.asList("6.3", "6.4.1", "6.5.1", "6.6.1", "6.7.1",
|
||||
"current", "7.0-rc-1");
|
||||
private static final List<String> GRADLE_VERSIONS;
|
||||
|
||||
static {
|
||||
JavaVersion javaVersion = JavaVersion.current();
|
||||
if (javaVersion.isCompatibleWith(JavaVersion.VERSION_16)) {
|
||||
GRADLE_VERSIONS = Arrays.asList("7.0-rc-1");
|
||||
}
|
||||
else {
|
||||
GRADLE_VERSIONS = Arrays.asList("6.3", "6.4.1", "6.5.1", "6.6.1", "6.7.1", "current", "7.0-rc-1");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<TestTemplateInvocationContext> provideTestTemplateInvocationContexts(ExtensionContext context) {
|
||||
|
||||
@@ -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.
|
||||
@@ -20,6 +20,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.gradle.api.JavaVersion;
|
||||
import org.junit.jupiter.api.TestTemplate;
|
||||
import org.junit.jupiter.api.extension.Extension;
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
@@ -59,7 +60,12 @@ public class GradleMultiDslExtension implements TestTemplateInvocationContextPro
|
||||
|
||||
@Override
|
||||
public List<Extension> getAdditionalExtensions() {
|
||||
return Arrays.asList(new GradleBuildFieldSetter(new GradleBuild(this.dsl)), new GradleBuildExtension());
|
||||
GradleBuild gradleBuild = new GradleBuild(this.dsl);
|
||||
JavaVersion javaVersion = JavaVersion.current();
|
||||
if (javaVersion.isCompatibleWith(JavaVersion.VERSION_16)) {
|
||||
gradleBuild.gradleVersion("7.0-rc-1");
|
||||
}
|
||||
return Arrays.asList(new GradleBuildFieldSetter(gradleBuild), new GradleBuildExtension());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
package org.springframework.boot.gradle.plugin;
|
||||
|
||||
import org.junit.jupiter.api.TestTemplate;
|
||||
import org.junit.jupiter.api.condition.DisabledForJreRange;
|
||||
import org.junit.jupiter.api.condition.JRE;
|
||||
|
||||
import org.springframework.boot.gradle.junit.GradleCompatibility;
|
||||
import org.springframework.boot.gradle.testkit.GradleBuild;
|
||||
@@ -28,6 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@DisabledForJreRange(min = JRE.JAVA_16)
|
||||
@GradleCompatibility(versionsLessThan = "7.0-milestone-1")
|
||||
class MavenPluginActionIntegrationTests {
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ class SpringBootPluginIntegrationTests {
|
||||
.contains("Spring Boot plugin requires Gradle 6 (6.3 or later). The current version is Gradle 6.2.2");
|
||||
}
|
||||
|
||||
@DisabledForJreRange(min = JRE.JAVA_16)
|
||||
@Test
|
||||
void succeedWithVersionOfGradle6MatchingWithIsRequired() {
|
||||
this.gradleBuild.gradleVersion("6.3").build();
|
||||
|
||||
@@ -23,6 +23,8 @@ import java.io.IOException;
|
||||
import org.gradle.testkit.runner.BuildResult;
|
||||
import org.gradle.testkit.runner.TaskOutcome;
|
||||
import org.junit.jupiter.api.TestTemplate;
|
||||
import org.junit.jupiter.api.condition.DisabledForJreRange;
|
||||
import org.junit.jupiter.api.condition.JRE;
|
||||
|
||||
import org.springframework.boot.gradle.junit.GradleCompatibility;
|
||||
import org.springframework.boot.gradle.testkit.GradleBuild;
|
||||
@@ -34,6 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@DisabledForJreRange(min = JRE.JAVA_16)
|
||||
@GradleCompatibility(versionsLessThan = "7.0-milestone-1")
|
||||
class MavenIntegrationTests {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user