aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorGary Gregory <gardgregory@gmail.com>2022-07-28 07:57:17 -0400
committerGary Gregory <gardgregory@gmail.com>2022-07-28 07:57:17 -0400
commit73a3f2d08701ba8d222ff2f9e023428c46457311 (patch)
tree0374a2b88ca5f6d1b4b8bd17b87b6bfa76bd44eb /src/test
parentc5e8b7b4f8fbd03e3e96098030409fc9edb56bde (diff)
downloadapache-commons-io-73a3f2d08701ba8d222ff2f9e023428c46457311.tar.gz
Add IORunnable#asRunnable()
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/apache/commons/io/function/IORunnableTest.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/java/org/apache/commons/io/function/IORunnableTest.java b/src/test/java/org/apache/commons/io/function/IORunnableTest.java
index 2a77d6ea..4788f6ee 100644
--- a/src/test/java/org/apache/commons/io/function/IORunnableTest.java
+++ b/src/test/java/org/apache/commons/io/function/IORunnableTest.java
@@ -18,10 +18,16 @@
package org.apache.commons.io.function;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.nio.file.Files;
+import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicReference;
+import org.apache.commons.io.file.PathUtils;
import org.junit.jupiter.api.Test;
/**
@@ -42,4 +48,11 @@ public class IORunnableTest {
assertEquals("A1", ref.get());
}
+ @Test
+ public void testAsRunnable() throws Exception {
+ assertThrows(UncheckedIOException.class, () -> Executors.callable(TestConstants.THROWING_IO_RUNNABLE.asRunnable()).call());
+ final IORunnable runnable = () -> Files.size(PathUtils.current());
+ assertNull(Executors.callable(runnable.asRunnable()).call());
+ }
+
}