Browse Source

Adapt tests for support for Java 14

See gh-20576
pull/20629/head
Stephane Nicoll 6 years ago
parent
commit
579a6ac254
  1. 13
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/diagnostics/analyzer/NoSuchBeanDefinitionFailureAnalyzerTests.java
  2. 2
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/pom.xml
  3. 3
      spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/TestJarCreator.java
  4. 10
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/JavaVersion.java
  5. 19
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-kafka/pom.xml

13
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/diagnostics/analyzer/NoSuchBeanDefinitionFailureAnalyzerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.
@ -34,6 +34,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; @@ -34,6 +34,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.diagnostics.FailureAnalysis;
import org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter;
import org.springframework.boot.system.JavaVersion;
import org.springframework.boot.test.util.TestPropertyValues;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
@ -153,8 +154,14 @@ class NoSuchBeanDefinitionFailureAnalyzerTests { @@ -153,8 +154,14 @@ class NoSuchBeanDefinitionFailureAnalyzerTests {
@Test
void failureAnalysisForUnmatchedQualifier() {
FailureAnalysis analysis = analyzeFailure(createFailure(QualifiedBeanConfiguration.class));
assertThat(analysis.getDescription())
.containsPattern("@org.springframework.beans.factory.annotation.Qualifier\\(value=\"*alpha\"*\\)");
assertThat(analysis.getDescription()).containsPattern(determineAnnotationValuePattern());
}
private String determineAnnotationValuePattern() {
if (JavaVersion.getJavaVersion().isEqualOrNewerThan(JavaVersion.FOURTEEN)) {
return "@org.springframework.beans.factory.annotation.Qualifier\\(\"*alpha\"*\\)";
}
return "@org.springframework.beans.factory.annotation.Qualifier\\(value=\"*alpha\"*\\)";
}
@Test

2
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/pom.xml

@ -389,7 +389,7 @@ @@ -389,7 +389,7 @@
<profile>
<id>java13</id>
<activation>
<jdk>13</jdk>
<jdk>[13,)</jdk>
</activation>
<properties>
<gradle.task>assemble</gradle.task>

3
spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/TestJarCreator.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.
@ -98,6 +98,7 @@ public abstract class TestJarCreator { @@ -98,6 +98,7 @@ public abstract class TestJarCreator {
writeEntry(jarOutputStream, "META-INF/versions/11/multi-release.dat", 11);
writeEntry(jarOutputStream, "META-INF/versions/12/multi-release.dat", 12);
writeEntry(jarOutputStream, "META-INF/versions/13/multi-release.dat", 13);
writeEntry(jarOutputStream, "META-INF/versions/14/multi-release.dat", 14);
}
else {
writeEntry(jarOutputStream, "3.dat", 3);

10
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/JavaVersion.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.
@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
package org.springframework.boot.system;
import java.lang.invoke.MethodHandles;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@ -60,7 +61,12 @@ public enum JavaVersion { @@ -60,7 +61,12 @@ public enum JavaVersion {
/**
* Java 13.
*/
THIRTEEN("13", String.class, "stripIndent");
THIRTEEN("13", String.class, "stripIndent"),
/**
* Java 14.
*/
FOURTEEN("14", MethodHandles.Lookup.class, "hasFullPrivilegeAccess");
private final String name;

19
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-kafka/pom.xml

@ -48,4 +48,23 @@ @@ -48,4 +48,23 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>java14+</id>
<activation>
<jdk>[14,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

Loading…
Cancel
Save