Merge branch '3.1.x'

Closes gh-38878
This commit is contained in:
Phillip Webb
2023-12-19 23:10:49 -08:00
6 changed files with 32 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 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.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import jakarta.servlet.ServletContext;
import org.junit.jupiter.api.Test;
@@ -80,7 +81,7 @@ class SpringBootMockServletContextTests implements ServletContextAware {
};
URL resource = context.getResource("/");
assertThat(resource).isNotNull();
File file = new File(URLDecoder.decode(resource.getPath(), "UTF-8"));
File file = new File(URLDecoder.decode(resource.getPath(), StandardCharsets.UTF_8));
assertThat(file).exists().isDirectory();
String[] contents = file.list((dir, name) -> !(".".equals(name) || "..".equals(name)));
assertThat(contents).isNotNull();