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 2022/07/26 18:30:02 UTC
[commons-io] branch master updated: Add missing IOUtils test
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-io.git
The following commit(s) were added to refs/heads/master by this push:
new e366fde1 Add missing IOUtils test
e366fde1 is described below
commit e366fde1c8b4d26852d1ae36e666745ce411b8b9
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 26 14:29:56 2022 -0400
Add missing IOUtils test
---
src/test/java/org/apache/commons/io/IOUtilsTest.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/test/java/org/apache/commons/io/IOUtilsTest.java b/src/test/java/org/apache/commons/io/IOUtilsTest.java
index 3e6c3a86..43c77365 100644
--- a/src/test/java/org/apache/commons/io/IOUtilsTest.java
+++ b/src/test/java/org/apache/commons/io/IOUtilsTest.java
@@ -49,6 +49,7 @@ import java.net.ServerSocket;
import java.net.Socket;
import java.net.URI;
import java.net.URL;
+import java.net.URLConnection;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.Selector;
@@ -441,6 +442,13 @@ public class IOUtilsTest {
});
}
+ @Test
+ public void testCloseURLConnection() {
+ assertDoesNotThrow(() -> IOUtils.close((URLConnection) null));
+ assertDoesNotThrow(() -> IOUtils.close(new URL("https://www.apache.org/").openConnection()));
+ assertDoesNotThrow(() -> IOUtils.close(new URL("file:///").openConnection()));
+ }
+
@Test
public void testConstants() {
assertEquals('/', IOUtils.DIR_SEPARATOR_UNIX);