You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2019/07/02 08:54:02 UTC
[directory-ldap-api] branch master updated: Use the @TempDir
annotation to delete the temporary file when the test ends
This is an automated email from the ASF dual-hosted git repository.
elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-ldap-api.git
The following commit(s) were added to refs/heads/master by this push:
new ceeec29 Use the @TempDir annotation to delete the temporary file when the test ends
ceeec29 is described below
commit ceeec29f5edb5ec5e317673e80a2cf1aac324e11
Author: emmanuel lecharny <el...@apache.org>
AuthorDate: Tue Jul 2 10:53:58 2019 +0200
Use the @TempDir annotation to delete the temporary file when the test
ends
---
.../directory/api/ldap/model/ldif/LdifAttributesReaderTest.java | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/ldap/model/src/test/java/org/apache/directory/api/ldap/model/ldif/LdifAttributesReaderTest.java b/ldap/model/src/test/java/org/apache/directory/api/ldap/model/ldif/LdifAttributesReaderTest.java
index de59d69..5cb76d6 100644
--- a/ldap/model/src/test/java/org/apache/directory/api/ldap/model/ldif/LdifAttributesReaderTest.java
+++ b/ldap/model/src/test/java/org/apache/directory/api/ldap/model/ldif/LdifAttributesReaderTest.java
@@ -31,8 +31,6 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
@@ -49,6 +47,7 @@ import org.apache.directory.api.util.Strings;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.junit.jupiter.api.parallel.Execution;
import org.junit.jupiter.api.parallel.ExecutionMode;
@@ -66,13 +65,12 @@ public class LdifAttributesReaderTest
private File jpegFile;
- private File tmpFolder;
+ @TempDir
+ public File tmpFolder;
private File createFile( String name, byte[] data ) throws IOException
{
- Path tmpFolder = Files.createTempDirectory( LdifAttributesReaderTest.class.getSimpleName() );
-
jpegFile = File.createTempFile( tmpFolder.toString(), name + ".jpg" );
DataOutputStream os = new DataOutputStream( new FileOutputStream( jpegFile ) );