Merge branch '3.1.x'

Closes gh-38168
This commit is contained in:
Andy Wilkinson 2023-11-01 15:04:53 +00:00
commit 173e6543fd
15 changed files with 23 additions and 23 deletions

View File

@ -100,7 +100,7 @@ class BuildInfoTests {
} }
@Test @Test
void nameCanBeExludedRemovedFromProperties() { void nameCanBeExcludedFromProperties() {
BuildInfo task = createTask(createProject("test")); BuildInfo task = createTask(createProject("test"));
task.getExcludes().add("name"); task.getExcludes().add("name");
assertThat(buildInfoProperties(task)).doesNotContainKey("build.name"); assertThat(buildInfoProperties(task)).doesNotContainKey("build.name");

View File

@ -41,7 +41,7 @@ final class Canonicalizer {
static String canonicalize(String path) { static String canonicalize(String path) {
path = removeEmbeddedSlashDotDotSlash(path); path = removeEmbeddedSlashDotDotSlash(path);
path = removedEmbdeddedSlashDotSlash(path); path = removeEmbeddedSlashDotSlash(path);
path = removeTrailingSlashDotDot(path); path = removeTrailingSlashDotDot(path);
path = removeTrailingSlashDot(path); path = removeTrailingSlashDot(path);
return path; return path;
@ -57,7 +57,7 @@ final class Canonicalizer {
return path; return path;
} }
private static String removedEmbdeddedSlashDotSlash(String path) { private static String removeEmbeddedSlashDotSlash(String path) {
int index; int index;
while ((index = path.indexOf("/./")) >= 0) { while ((index = path.indexOf("/./")) >= 0) {
String before = path.substring(0, index); String before = path.substring(0, index);

View File

@ -242,7 +242,7 @@ class NestedJarFileTests {
} }
@Test @Test
void sizeWhenClosedThowsException() throws Exception { void sizeWhenClosedThrowsException() throws Exception {
try (NestedJarFile jar = new NestedJarFile(this.file)) { try (NestedJarFile jar = new NestedJarFile(this.file)) {
jar.close(); jar.close();
assertThatIllegalStateException().isThrownBy(() -> jar.size()).withMessage("Zip file closed"); assertThatIllegalStateException().isThrownBy(() -> jar.size()).withMessage("Zip file closed");
@ -347,7 +347,7 @@ class NestedJarFileTests {
} }
@Test @Test
void streamStreamsEnties() throws IOException { void streamStreamsEntries() throws IOException {
try (NestedJarFile jar = new NestedJarFile(this.file, "multi-release.jar")) { try (NestedJarFile jar = new NestedJarFile(this.file, "multi-release.jar")) {
assertThat(jar.stream().map((entry) -> entry.getName() + ":" + entry.getRealName())).containsExactly( assertThat(jar.stream().map((entry) -> entry.getName() + ":" + entry.getRealName())).containsExactly(
"META-INF/:META-INF/", "META-INF/MANIFEST.MF:META-INF/MANIFEST.MF", "META-INF/:META-INF/", "META-INF/MANIFEST.MF:META-INF/MANIFEST.MF",

View File

@ -55,7 +55,7 @@ class SecurityInfoTests {
} }
@Test @Test
void getWhenHasSignatureFileButNoSecuityMaterialReturnsNone() throws Exception { void getWhenHasSignatureFileButNoSecurityMaterialReturnsNone() throws Exception {
File file = new File(this.temp, "test.jar"); File file = new File(this.temp, "test.jar");
TestJar.create(file, false, true); TestJar.create(file, false, true);
try (ZipContent content = ZipContent.open(file.toPath())) { try (ZipContent content = ZipContent.open(file.toPath())) {

View File

@ -80,7 +80,7 @@ class JarFileArchiveTests {
} }
@Test @Test
void getClassPathUrlsWhenNoPredicartesReturnsUrls() throws Exception { void getClassPathUrlsWhenNoPredicatesReturnsUrls() throws Exception {
Set<URL> urls = this.archive.getClassPathUrls(Archive.ALL_ENTRIES); Set<URL> urls = this.archive.getClassPathUrls(Archive.ALL_ENTRIES);
URL[] expected = TestJar.expectedEntries() URL[] expected = TestJar.expectedEntries()
.stream() .stream()

View File

@ -35,12 +35,12 @@ class CanonicalizerTests {
} }
@Test @Test
void canonicalizeWhenHasEmbdeddSlashDotDotSlash() { void canonicalizeWhenHasEmbeddedSlashDotDotSlash() {
assertThat(Canonicalizer.canonicalize("/foo/../bar/bif/bam/../../baz")).isEqualTo("/bar/baz"); assertThat(Canonicalizer.canonicalize("/foo/../bar/bif/bam/../../baz")).isEqualTo("/bar/baz");
} }
@Test @Test
void canonicalizeWhenHasEmbdeddSlashDotSlash() { void canonicalizeWhenHasEmbeddedSlashDotSlash() {
assertThat(Canonicalizer.canonicalize("/foo/./bar/bif/bam/././baz")).isEqualTo("/foo/bar/bif/bam/baz"); assertThat(Canonicalizer.canonicalize("/foo/./bar/bif/bam/././baz")).isEqualTo("/foo/bar/bif/bam/baz");
} }

View File

@ -255,7 +255,7 @@ class JarUrlConnectionTests {
} }
@Test @Test
void getInputStreamWhenNoEntryAndOptimzedThrowsException() throws Exception { void getInputStreamWhenNoEntryAndOptimizedThrowsException() throws Exception {
JarUrlConnection setupConnection = JarUrlConnection.open(JarUrl.create(this.file, "nested.jar")); JarUrlConnection setupConnection = JarUrlConnection.open(JarUrl.create(this.file, "nested.jar"));
setupConnection.connect(); setupConnection.connect();
assertThat(JarUrlConnection.jarFiles.getCached(setupConnection.getJarFileURL())).isNotNull(); assertThat(JarUrlConnection.jarFiles.getCached(setupConnection.getJarFileURL())).isNotNull();
@ -266,7 +266,7 @@ class JarUrlConnectionTests {
} }
@Test @Test
void getInputStreamWhenNoEntryAndNotOptimzedThrowsException() throws Exception { void getInputStreamWhenNoEntryAndNotOptimizedThrowsException() throws Exception {
JarUrlConnection connection = JarUrlConnection.open(JarUrl.create(this.file, "nested.jar", "missing.dat")); JarUrlConnection connection = JarUrlConnection.open(JarUrl.create(this.file, "nested.jar", "missing.dat"));
assertThatExceptionOfType(FileNotFoundException.class).isThrownBy(connection::getInputStream) assertThatExceptionOfType(FileNotFoundException.class).isThrownBy(connection::getInputStream)
.withMessageContaining("JAR entry missing.dat not found in"); .withMessageContaining("JAR entry missing.dat not found in");
@ -475,7 +475,7 @@ class JarUrlConnectionTests {
} }
@Test @Test
void openWhenNestedAndInCachedWithoutEntryAndOptimzationsEnabledReturnsNoFoundConnection() throws Exception { void openWhenNestedAndInCachedWithoutEntryAndOptimizationsEnabledReturnsNoFoundConnection() throws Exception {
JarUrlConnection setupConnection = JarUrlConnection.open(JarUrl.create(this.file, "nested.jar")); JarUrlConnection setupConnection = JarUrlConnection.open(JarUrl.create(this.file, "nested.jar"));
setupConnection.connect(); setupConnection.connect();
assertThat(JarUrlConnection.jarFiles.getCached(setupConnection.getJarFileURL())).isNotNull(); assertThat(JarUrlConnection.jarFiles.getCached(setupConnection.getJarFileURL())).isNotNull();

View File

@ -58,7 +58,7 @@ class UrlJarManifestTests {
} }
@Test @Test
void getEntrtyAttributesWhenSuppliedManifestIsNullReturnsNull() throws Exception { void getEntryAttributesWhenSuppliedManifestIsNullReturnsNull() throws Exception {
UrlJarManifest urlJarManifest = new UrlJarManifest(() -> null); UrlJarManifest urlJarManifest = new UrlJarManifest(() -> null);
assertThat(urlJarManifest.getEntryAttributes(new JarEntry("test"))).isNull(); assertThat(urlJarManifest.getEntryAttributes(new JarEntry("test"))).isNull();
} }

View File

@ -82,7 +82,7 @@ class NestedLocationTests {
} }
@Test @Test
void fromUrlWhenNoSeparatorThrowsExceptiuon() { void fromUrlWhenNoSeparatorThrowsException() {
assertThatIllegalArgumentException() assertThatIllegalArgumentException()
.isThrownBy(() -> NestedLocation.fromUrl(new URL("nested:test.jar!nested.jar"))) .isThrownBy(() -> NestedLocation.fromUrl(new URL("nested:test.jar!nested.jar")))
.withMessageContaining("'path' must contain '/!'"); .withMessageContaining("'path' must contain '/!'");
@ -110,7 +110,7 @@ class NestedLocationTests {
} }
@Test @Test
void fromUriWhenNoSeparatorThrowsExceptiuon() { void fromUriWhenNoSeparatorThrowsException() {
assertThatIllegalArgumentException() assertThatIllegalArgumentException()
.isThrownBy(() -> NestedLocation.fromUri(new URI("nested:test.jar!nested.jar"))) .isThrownBy(() -> NestedLocation.fromUri(new URI("nested:test.jar!nested.jar")))
.withMessageContaining("'path' must contain '/!'"); .withMessageContaining("'path' must contain '/!'");

View File

@ -65,7 +65,7 @@ class NestedByteChannelTests {
} }
@AfterEach @AfterEach
void cleanuo() throws Exception { void cleanup() throws Exception {
this.channel.close(); this.channel.close();
} }

View File

@ -78,7 +78,7 @@ class NestedPathTests {
} }
@Test @Test
void isAbsoluteRerturnsTrue() { void isAbsoluteReturnsTrue() {
assertThat(this.path.isAbsolute()).isTrue(); assertThat(this.path.isAbsolute()).isTrue();
} }

View File

@ -96,7 +96,7 @@ class DataBlockInputStreamTests {
} }
@Test @Test
void skipBackwardsPastBeginingSkipsBytes() throws Exception { void skipBackwardsPastBeginningSkipsBytes() throws Exception {
assertThat(this.inputStream.skip(1)).isEqualTo(1); assertThat(this.inputStream.skip(1)).isEqualTo(1);
assertThat(this.inputStream.skip(-100)).isEqualTo(-1); assertThat(this.inputStream.skip(-100)).isEqualTo(-1);
assertThat(this.inputStream.read()).isEqualTo(0); assertThat(this.inputStream.read()).isEqualTo(0);

View File

@ -220,7 +220,7 @@ class ConfigDataEnvironmentPostProcessorIntegrationTests {
} }
@Test @Test
void runWhenHasActiveProfilesFromMultipleAdditionaLocationsWithOneSwitchedOffLoadsExpectedProperties() { void runWhenHasActiveProfilesFromMultipleAdditionalLocationsWithOneSwitchedOffLoadsExpectedProperties() {
ConfigurableApplicationContext context = this.application.run( ConfigurableApplicationContext context = this.application.run(
"--spring.config.additional-location=classpath:enabletwoprofiles.properties,classpath:enableprofile.properties"); "--spring.config.additional-location=classpath:enabletwoprofiles.properties,classpath:enableprofile.properties");
ConfigurableEnvironment environment = context.getEnvironment(); ConfigurableEnvironment environment = context.getEnvironment();
@ -230,7 +230,7 @@ class ConfigDataEnvironmentPostProcessorIntegrationTests {
} }
@Test @Test
void runWhenHaslocalFileLoadsWithLocalFileTakingPrecedenceOverClasspath() throws Exception { void runWhenHasLocalFileLoadsWithLocalFileTakingPrecedenceOverClasspath() throws Exception {
File localFile = new File(new File("."), "application.properties"); File localFile = new File(new File("."), "application.properties");
assertThat(localFile).doesNotExist(); assertThat(localFile).doesNotExist();
try { try {

View File

@ -214,7 +214,7 @@ class BindableRuntimeHintsRegistrarTests {
} }
@Test @Test
void pregisterHintsWhenHasUnresolvedGeneric() { void registerHintsWhenHasUnresolvedGeneric() {
RuntimeHints runtimeHints = registerHints(WithGeneric.class); RuntimeHints runtimeHints = registerHints(WithGeneric.class);
assertThat(runtimeHints.reflection().typeHints()).hasSize(2) assertThat(runtimeHints.reflection().typeHints()).hasSize(2)
.anySatisfy(javaBeanBinding(WithGeneric.class, "getGeneric")) .anySatisfy(javaBeanBinding(WithGeneric.class, "getGeneric"))

View File

@ -185,7 +185,7 @@ class LogbackConfigurationAotContributionTests {
@Test @Test
void componentTypesOfArraysAreRegisteredForReflection() { void componentTypesOfArraysAreRegisteredForReflection() {
ComponentModel component = new ComponentModel(); ComponentModel component = new ComponentModel();
component.setClassName(ArrayParmeters.class.getName()); component.setClassName(ArrayParameters.class.getName());
TestGenerationContext generationContext = applyContribution(component); TestGenerationContext generationContext = applyContribution(component);
assertThat(invokePublicConstructorsAndInspectAndInvokePublicMethodsOf(InetSocketAddress.class)) assertThat(invokePublicConstructorsAndInspectAndInvokePublicMethodsOf(InetSocketAddress.class))
.accepts(generationContext.getRuntimeHints()); .accepts(generationContext.getRuntimeHints());
@ -287,7 +287,7 @@ class LogbackConfigurationAotContributionTests {
} }
public static class ArrayParmeters { public static class ArrayParameters {
public void addDestinations(InetSocketAddress... addresses) { public void addDestinations(InetSocketAddress... addresses) {