From fe226090960bbdb36099d9099684d6649859a6bb Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 21 Jul 2016 13:51:51 +0100 Subject: [PATCH] Test that temp file has been deleted before triggering heap dump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The MBean requires that a file does not exist at the location to which it’s dumping the heap. This commit updates the test to ensure that the temporary file that’s created to get a location for the heap dump file is deleted before asking the MBean to dump the heap to that location. --- .../boot/actuate/endpoint/mvc/HeapdumpMvcEndpointTests.java | 3 +++ 1 file changed, 3 insertions(+) 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); }