From a2be276dd8c04851bdad531e26a1cbe30a4417c8 Mon Sep 17 00:00:00 2001 From: Eric Haag Date: Thu, 14 Sep 2023 12:25:00 -0500 Subject: [PATCH] Mock working directory for extract test Prior to this change, this test would create files in the project directory. This can cause issues with Gradle caching and up-to-date checks. To address this, the value of the working directory is mocked to a temporary directory like all the other tests. See gh-37395 --- .../boot/jarmode/layertools/ExtractCommandTests.java | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/ExtractCommandTests.java b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/ExtractCommandTests.java index f865a4077b4..6d3c3c01818 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/ExtractCommandTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/ExtractCommandTests.java @@ -167,6 +167,7 @@ class ExtractCommandTests { } }); given(this.context.getArchiveFile()).willReturn(this.jarFile); + given(this.context.getWorkingDir()).willReturn(this.extract); assertThatIllegalStateException() .isThrownBy(() -> this.command.run(Collections.emptyMap(), Collections.emptyList())) .withMessageContaining("Entry 'e/../../e.jar' would be written");