Skip to content

Commit 6c0be21

Browse files
committed
fixes FileSystemException
1 parent 5f92444 commit 6c0be21

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/EclipseLinkMetaAnnotatedQueryMethodIntegrationTests.java

+8-11
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,18 @@
1919

2020
import jakarta.persistence.EntityManagerFactory;
2121

22-
import java.io.FileOutputStream;
2322
import java.io.IOException;
2423
import java.io.InputStreamReader;
2524
import java.io.Reader;
2625
import java.nio.charset.StandardCharsets;
26+
import java.nio.file.Files;
2727
import java.nio.file.Path;
2828
import java.util.Properties;
2929

3030
import javax.sql.DataSource;
3131

3232
import org.junit.jupiter.api.AfterAll;
33+
import org.junit.jupiter.api.BeforeAll;
3334
import org.junit.jupiter.api.BeforeEach;
3435
import org.junit.jupiter.api.Test;
3536
import org.junit.jupiter.api.extension.ExtendWith;
@@ -58,12 +59,12 @@
5859
import org.springframework.transaction.PlatformTransactionManager;
5960
import org.springframework.transaction.annotation.Transactional;
6061
import org.springframework.util.FileCopyUtils;
61-
import org.springframework.util.FileSystemUtils;
6262

6363
/**
6464
* Verify that {@link Meta}-annotated methods properly embed comments into EclipseLink queries.
6565
*
6666
* @author Greg Turnquist
67+
* @author Edoardo Patti
6768
* @since 3.0
6869
*/
6970
@ExtendWith(SpringExtension.class)
@@ -74,16 +75,12 @@ class EclipseLinkMetaAnnotatedQueryMethodIntegrationTests {
7475
@Autowired RoleRepositoryWithMeta repository;
7576

7677
private static final ResourceLoader RESOURCE_LOADER = new DefaultResourceLoader();
77-
private static final String LOG_FILE = "test-eclipselink-meta.log";
78+
private static String LOG_FILE;
7879

79-
@BeforeEach
80-
void cleanoutLogfile() throws IOException {
81-
new FileOutputStream(LOG_FILE).close();
82-
}
83-
84-
@AfterAll
85-
static void deleteLogfile() throws IOException {
86-
FileSystemUtils.deleteRecursively(Path.of(LOG_FILE));
80+
@BeforeAll
81+
static void createLogfile() throws IOException {
82+
Path logFile = Files.createTempFile("test-eclipselink-meta", ".log");
83+
LOG_FILE = logFile.toAbsolutePath().toString();
8784
}
8885

8986
@Test // GH-775

0 commit comments

Comments
 (0)