mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-20 06:29:16 +00:00
Merge branch '3.5.x' into 4.0.x
This commit is contained in:
@@ -152,6 +152,8 @@ public class ApplicationTemp {
|
||||
assertDirectoryOwnership(attributes.owner(), path);
|
||||
}
|
||||
else {
|
||||
Assert.state(Files.isDirectory(path, LinkOption.NOFOLLOW_LINKS),
|
||||
() -> "'" + path + "' already exists but it is not a directory");
|
||||
try {
|
||||
assertDirectoryOwnership(Files.getOwner(path, LinkOption.NOFOLLOW_LINKS), path);
|
||||
}
|
||||
|
||||
+10
-1
@@ -27,8 +27,11 @@ import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Assumptions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.DisabledOnOs;
|
||||
import org.junit.jupiter.api.condition.OS;
|
||||
|
||||
import org.springframework.util.FileSystemUtils;
|
||||
|
||||
@@ -88,6 +91,7 @@ class ApplicationTempTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisabledOnOs(OS.WINDOWS)
|
||||
void whenDirectoryExistsWithWrongPermissionsGetDirThrows() throws IOException {
|
||||
ApplicationTemp temp = new ApplicationTemp();
|
||||
Path path = temp.getDir().toPath();
|
||||
@@ -104,7 +108,12 @@ class ApplicationTempTests {
|
||||
Path path = temp.getDir().toPath();
|
||||
FileSystemUtils.deleteRecursively(path);
|
||||
Path linkTarget = Files.createTempDirectory("application-test-tests");
|
||||
Files.createSymbolicLink(path, linkTarget);
|
||||
try {
|
||||
Files.createSymbolicLink(path, linkTarget);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Assumptions.abort("Symlink creation not supported");
|
||||
}
|
||||
assertThatIllegalStateException().isThrownBy(new ApplicationTemp()::getDir)
|
||||
.withMessageContaining("already exists but it is not a directory");
|
||||
FileSystemUtils.deleteRecursively(path);
|
||||
|
||||
Reference in New Issue
Block a user