From 0ab8b6e0a969024c5cb0b2034204f108c153a3c0 Mon Sep 17 00:00:00 2001 From: Atul Mohan Date: Wed, 7 Oct 2020 08:40:02 -0500 Subject: [PATCH] Improve test (#10480) --- .../apache/druid/java/util/common/FileUtilsTest.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/src/test/java/org/apache/druid/java/util/common/FileUtilsTest.java b/core/src/test/java/org/apache/druid/java/util/common/FileUtilsTest.java index 446339e35cb..a20784f3b42 100644 --- a/core/src/test/java/org/apache/druid/java/util/common/FileUtilsTest.java +++ b/core/src/test/java/org/apache/druid/java/util/common/FileUtilsTest.java @@ -103,12 +103,14 @@ public class FileUtilsTest @Test public void testCreateTempDirNonexistentBase() { - expectedException.expect(IllegalStateException.class); - expectedException.expectMessage("java.io.tmpdir (/nonexistent) does not exist"); - final String oldJavaTmpDir = System.getProperty("java.io.tmpdir"); + final String nonExistentDir = oldJavaTmpDir + "/nonexistent"; + + expectedException.expect(IllegalStateException.class); + expectedException.expectMessage(StringUtils.format("java.io.tmpdir (%s) does not exist", nonExistentDir)); + try { - System.setProperty("java.io.tmpdir", "/nonexistent"); + System.setProperty("java.io.tmpdir", nonExistentDir); FileUtils.createTempDir(); } finally {