From 2927ab512cc4a5bb216ffadcef44358046a09ae3 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Wed, 19 Jul 2023 12:19:38 -0400 Subject: [PATCH] Reuse FileUtils in tests --- .../commons/configuration2/TestCompositeConfiguration.java | 3 ++- .../commons/configuration2/TestNullCompositeConfiguration.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/apache/commons/configuration2/TestCompositeConfiguration.java b/src/test/java/org/apache/commons/configuration2/TestCompositeConfiguration.java index 330da863f1..9d605e5367 100644 --- a/src/test/java/org/apache/commons/configuration2/TestCompositeConfiguration.java +++ b/src/test/java/org/apache/commons/configuration2/TestCompositeConfiguration.java @@ -45,6 +45,7 @@ import org.apache.commons.configuration2.event.EventListenerTestImpl; import org.apache.commons.configuration2.ex.ConfigurationRuntimeException; import org.apache.commons.configuration2.io.FileHandler; +import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -788,7 +789,7 @@ public void testSubsetCanResolve() throws Exception { cc.addConfiguration(ConfigurationConverter.getConfiguration(System.getProperties())); final Configuration subset = cc.subset("subset"); - assertEquals(System.getProperty("java.io.tmpdir") + "/file.tmp", subset.getString("tempfile")); + assertEquals(FileUtils.getTempDirectoryPath() + "/file.tmp", subset.getString("tempfile")); } @Test diff --git a/src/test/java/org/apache/commons/configuration2/TestNullCompositeConfiguration.java b/src/test/java/org/apache/commons/configuration2/TestNullCompositeConfiguration.java index 37ecf83599..0c5b65bed8 100644 --- a/src/test/java/org/apache/commons/configuration2/TestNullCompositeConfiguration.java +++ b/src/test/java/org/apache/commons/configuration2/TestNullCompositeConfiguration.java @@ -33,6 +33,7 @@ import org.apache.commons.configuration2.convert.LegacyListDelimiterHandler; import org.apache.commons.configuration2.convert.ListDelimiterHandler; import org.apache.commons.configuration2.io.FileHandler; +import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -396,7 +397,7 @@ public void testSubsetCanResolve() throws Exception { cc.addConfiguration(ConfigurationConverter.getConfiguration(System.getProperties())); final Configuration subset = cc.subset("subset"); - assertEquals(System.getProperty("java.io.tmpdir") + "/file.tmp", subset.getString("tempfile")); + assertEquals(FileUtils.getTempDirectoryPath() + "/file.tmp", subset.getString("tempfile")); } @Test