mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-08-02 13:48:15 +02:00
Modernize and secure temp file creation
This commit is contained in:
parent
d8e1c693da
commit
f0b1cb11d0
@ -1,5 +1,6 @@
|
|||||||
package stirling.software.common.util;
|
package stirling.software.common.util;
|
||||||
|
|
||||||
|
import java.nio.file.Files;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
@ -47,8 +48,8 @@ public class FileToPdfTest {
|
|||||||
// Mock the temp file creation to return real temp files
|
// Mock the temp file creation to return real temp files
|
||||||
try {
|
try {
|
||||||
when(tempFileManager.createTempFile(anyString()))
|
when(tempFileManager.createTempFile(anyString()))
|
||||||
.thenReturn(File.createTempFile("test", ".pdf"))
|
.thenReturn(Files.createTempFile("test", ".pdf").toFile())
|
||||||
.thenReturn(File.createTempFile("test", ".html"));
|
.thenReturn(Files.createTempFile("test", ".html").toFile());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user