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-cli.git

commit b964c3172b15a50558c6b8668a79786702bdbceb
Author: Gary Gregory <[email protected]>
AuthorDate: Sun Apr 7 14:50:59 2024 -0400

    Add missing test
---
 pom.xml                                                   | 6 ++++++
 src/test/java/org/apache/commons/cli/TypeHandlerTest.java | 9 ++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index c77c4e6..06ab783 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,6 +62,12 @@
       <artifactId>junit-jupiter-params</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>2.16.0</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <properties>
diff --git a/src/test/java/org/apache/commons/cli/TypeHandlerTest.java 
b/src/test/java/org/apache/commons/cli/TypeHandlerTest.java
index 6267069..3b306c3 100644
--- a/src/test/java/org/apache/commons/cli/TypeHandlerTest.java
+++ b/src/test/java/org/apache/commons/cli/TypeHandlerTest.java
@@ -24,6 +24,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.net.MalformedURLException;
@@ -40,6 +41,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.stream.Stream;
 
+import org.apache.commons.io.IOUtils;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.Arguments;
@@ -185,9 +187,10 @@ public class TypeHandlerTest {
     }
 
     @Test
-    public void testOpenFile() {
-        final File file = new File("").getAbsoluteFile();
-        assertEquals(file, TypeHandler.createFile(file.toString()));
+    public void testOpenFile() throws ParseException, IOException {
+        try (FileInputStream fis = 
TypeHandler.openFile("src/test/resources/org/apache/commons/cli/existing-readable.file"))
 {
+            IOUtils.consume(fis);
+        }
     }
 
     @Test

Reply via email to