diff --git a/src/test/java/com/synopsys/integration/blackduck/dockerinspector/endtoend/CalledFromDetectTest.java b/src/test/java/com/synopsys/integration/blackduck/dockerinspector/endtoend/CalledFromDetectTest.java index 644d7e09..f00657c3 100644 --- a/src/test/java/com/synopsys/integration/blackduck/dockerinspector/endtoend/CalledFromDetectTest.java +++ b/src/test/java/com/synopsys/integration/blackduck/dockerinspector/endtoend/CalledFromDetectTest.java @@ -34,7 +34,7 @@ public static void setUpBeforeClass() throws Exception { programVersion = new ProgramVersion(); programVersion.init(); executionDir = Files.createTempDir(); - executionDir.deleteOnExit(); + FileUtils.forceDeleteOnExit(executionDir); } @Test @@ -50,7 +50,7 @@ public void test() throws IOException, InterruptedException, IntegrationExceptio File detectOutputFile = File.createTempFile("detectOutput", ".txt"); detectOutputFile.setWritable(true); - detectScriptFile.deleteOnExit(); + detectOutputFile.deleteOnExit(); StringBuffer sb = new StringBuffer(); sb.append("#\n"); @@ -70,7 +70,7 @@ public void test() throws IOException, InterruptedException, IntegrationExceptio System.out.printf("Detect wrapper script content:\n%s\n", detectWrapperScriptString); File detectWrapperScriptFile = File.createTempFile("detectWrapper", ".sh"); detectWrapperScriptFile.setExecutable(true); - detectScriptFile.deleteOnExit(); + detectWrapperScriptFile.deleteOnExit(); System.out.printf("script file: %s\n", detectWrapperScriptFile.getAbsolutePath()); FileUtils.write(detectWrapperScriptFile, detectWrapperScriptString, StandardCharsets.UTF_8); Map env = new HashMap<>(1); diff --git a/src/test/java/com/synopsys/integration/blackduck/dockerinspector/testutils/TestUtils.java b/src/test/java/com/synopsys/integration/blackduck/dockerinspector/testutils/TestUtils.java index 3f336320..6c6caf00 100644 --- a/src/test/java/com/synopsys/integration/blackduck/dockerinspector/testutils/TestUtils.java +++ b/src/test/java/com/synopsys/integration/blackduck/dockerinspector/testutils/TestUtils.java @@ -30,6 +30,7 @@ public static File createTempDirectory() throws IOException { if (!temp.mkdir()) { throw new IOException("Could not create temp directory: " + temp.getAbsolutePath()); } + FileUtils.forceDeleteOnExit(temp); return temp; }