Always delete temporary file created in test
@@ -161,13 +161,16 @@ public class Log4j1ConfigurationFactoryTest {
@Test
public void testSystemProperties1() throws Exception {
+ final String tempFileName = System.getProperty("java.io.tmpdir") + "/hadoop.log";
+ try {
final Configuration configuration = getConfiguration("config-1.2/log4j-system-properties-1.properties");
final RollingFileAppender appender = configuration.getAppender("RFA");
- final String tempFileName = System.getProperty("java.io.tmpdir") + "/hadoop.log";
System.out.println("expected: " + tempFileName + " Actual: " + appender.getFileName());
assertEquals(tempFileName, appender.getFileName());
+ } finally {
Files.deleteIfExists(new File(tempFileName).toPath());
}
+ }
@Test
public void testSystemProperties2() throws Exception {
