You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/01/27 19:23:37 UTC
[commons-crypto] branch master updated: Port some tests from IO to NIO APIs
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-crypto.git
The following commit(s) were added to refs/heads/master by this push:
new 3808fbf Port some tests from IO to NIO APIs
3808fbf is described below
commit 3808fbfcb9c6dbe857f351176ec2b7031714a158
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jan 27 14:23:33 2023 -0500
Port some tests from IO to NIO APIs
---
.../java/org/apache/commons/crypto/NativeCodeLoaderTest.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/test/java/org/apache/commons/crypto/NativeCodeLoaderTest.java b/src/test/java/org/apache/commons/crypto/NativeCodeLoaderTest.java
index 705f503..1a937eb 100644
--- a/src/test/java/org/apache/commons/crypto/NativeCodeLoaderTest.java
+++ b/src/test/java/org/apache/commons/crypto/NativeCodeLoaderTest.java
@@ -23,7 +23,8 @@ import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
-import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
@@ -70,15 +71,15 @@ public class NativeCodeLoaderTest {
final String nameKey = System.getProperty(Crypto.LIB_NAME_KEY);
final String pathKey = System.getProperty(Crypto.LIB_PATH_KEY);
// An empty file should cause UnsatisfiedLinkError
- final File empty = File.createTempFile("NativeCodeLoaderTest", "tmp");
+ final Path empty = Files.createTempFile("NativeCodeLoaderTest", "tmp");
try {
- System.setProperty(Crypto.LIB_PATH_KEY, empty.getParent());
- System.setProperty(Crypto.LIB_NAME_KEY, empty.getName());
+ System.setProperty(Crypto.LIB_PATH_KEY, empty.getParent().toString());
+ System.setProperty(Crypto.LIB_NAME_KEY, empty.getFileName().toString());
final Throwable result = NativeCodeLoader.loadLibrary();
assertNotNull(result);
assertTrue(result instanceof UnsatisfiedLinkError);
} finally {
- empty.delete();
+ Files.delete(empty);
if (nameKey != null) {
System.setProperty(Crypto.LIB_NAME_KEY, nameKey);
}