Skip to content

Commit a2be276

Browse files
erichaagdevwilkinsona
authored andcommitted
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 spring-projectsgh-37395
1 parent 98acca9 commit a2be276

File tree

1 file changed

+1
-0
lines changed
  • spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools

1 file changed

+1
-0
lines changed

spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/ExtractCommandTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ void runWithJarFileThatWouldWriteEntriesOutsideDestinationFails() throws Excepti
167167
}
168168
});
169169
given(this.context.getArchiveFile()).willReturn(this.jarFile);
170+
given(this.context.getWorkingDir()).willReturn(this.extract);
170171
assertThatIllegalStateException()
171172
.isThrownBy(() -> this.command.run(Collections.emptyMap(), Collections.emptyList()))
172173
.withMessageContaining("Entry 'e/../../e.jar' would be written");

0 commit comments

Comments
 (0)