ottlinger commented on code in PR #195:
URL: https://github.com/apache/creadur-rat/pull/195#discussion_r1451623503
##########
apache-rat-core/src/test/java/org/apache/rat/annotation/TestLicenseAppender.java:
##########
@@ -18,25 +18,36 @@
*/
package org.apache.rat.annotation;
-import org.apache.commons.io.IOUtils;
+import org.apache.commons.io.FileUtils;
import org.apache.rat.test.utils.Resources;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
+import java.nio.file.Files;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
public class TestLicenseAppender {
- @ClassRule
- public static final TemporaryFolder baseTempFolder = new TemporaryFolder();
+
+ private static File baseTempFolder;
+
+ @BeforeAll
+ public static void setup() throws IOException {
+ baseTempFolder = Files.createTempDirectory("tla").toFile();
+ }
+
+ @AfterAll
+ public static void teardown() throws IOException {
+ FileUtils.deleteDirectory(baseTempFolder);
+ }
Review Comment:
I'd prefer to use @TempDir here ..... as suggested in
https://www.baeldung.com/junit-5-temporary-directory
(we had trouble with /tmp running out of space with hand-crafted solutions
in case of test failures a.s.o)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]