Commit 579a6ac2 authored by Stephane Nicoll's avatar Stephane Nicoll

Adapt tests for support for Java 14

See gh-20576
parent 58a45c53
/*
* 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;
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 {
@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
......
......@@ -389,7 +389,7 @@
<profile>
<id>java13</id>
<activation>
<jdk>13</jdk>
<jdk>[13,)</jdk>
</activation>
<properties>
<gradle.task>assemble</gradle.task>
......
/*
* 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 {
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);
......
/*
* 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 @@
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 {
/**
* Java 13.
*/
THIRTEEN("13", String.class, "stripIndent");
THIRTEEN("13", String.class, "stripIndent"),
/**
* Java 14.
*/
FOURTEEN("14", MethodHandles.Lookup.class, "hasFullPrivilegeAccess");
private final String name;
......
......@@ -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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment