Merge pull request #20180 from dreis2211
* pr/20180: Fix JarFileTests for multi-release JARs on JDK14 Polish "Handle new Annotation.toString() behaviour in JDK 14" Handle new Annotation.toString() behaviour in JDK 14 Closes gh-20180
This commit is contained in:
commit
af430dbdf5
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.boot.diagnostics.FailureAnalysis;
|
import org.springframework.boot.diagnostics.FailureAnalysis;
|
||||||
import org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter;
|
import org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter;
|
||||||
|
import org.springframework.boot.system.JavaVersion;
|
||||||
import org.springframework.boot.test.util.TestPropertyValues;
|
import org.springframework.boot.test.util.TestPropertyValues;
|
||||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
@ -153,8 +154,14 @@ class NoSuchBeanDefinitionFailureAnalyzerTests {
|
||||||
@Test
|
@Test
|
||||||
void failureAnalysisForUnmatchedQualifier() {
|
void failureAnalysisForUnmatchedQualifier() {
|
||||||
FailureAnalysis analysis = analyzeFailure(createFailure(QualifiedBeanConfiguration.class));
|
FailureAnalysis analysis = analyzeFailure(createFailure(QualifiedBeanConfiguration.class));
|
||||||
assertThat(analysis.getDescription())
|
assertThat(analysis.getDescription()).containsPattern(determineAnnotationValuePattern());
|
||||||
.containsPattern("@org.springframework.beans.factory.annotation.Qualifier\\(value=\"*alpha\"*\\)");
|
}
|
||||||
|
|
||||||
|
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
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,7 @@ public abstract class TestJarCreator {
|
||||||
writeEntry(jarOutputStream, "META-INF/versions/11/multi-release.dat", 11);
|
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/12/multi-release.dat", 12);
|
||||||
writeEntry(jarOutputStream, "META-INF/versions/13/multi-release.dat", 13);
|
writeEntry(jarOutputStream, "META-INF/versions/13/multi-release.dat", 13);
|
||||||
|
writeEntry(jarOutputStream, "META-INF/versions/14/multi-release.dat", 14);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
writeEntry(jarOutputStream, "3.dat", 3);
|
writeEntry(jarOutputStream, "3.dat", 3);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue