diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HeapdumpMvcEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HeapdumpMvcEndpointTests.java index e1547951765..42157bee1db 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HeapdumpMvcEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HeapdumpMvcEndpointTests.java @@ -152,6 +152,9 @@ public class HeapdumpMvcEndpointTests { if (TestHeapdumpMvcEndpoint.this.locked) { throw new InterruptedException(); } + if (file.exists()) { + throw new IOException("File exists"); + } FileCopyUtils.copy(TestHeapdumpMvcEndpoint.this.heapDump.getBytes(), file); }