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-vfs.git
The following commit(s) were added to refs/heads/master by this push:
new 75bdad709 Add some Unit Tests (#743)
75bdad709 is described below
commit 75bdad7099349fc4f73afadf2513f9bd1e45931c
Author: Michael Hausegger <[email protected]>
AuthorDate: Sat Nov 22 14:30:47 2025 +0100
Add some Unit Tests (#743)
Co-authored-by: TheRealHaui <[email protected]>
---
.../commons/vfs2/filter/SizeFileFilterTest.java | 6 ++++
.../org/apache/commons/vfs2/util/URIUtilsTest.java | 34 ++++++++++++++++++++++
2 files changed, 40 insertions(+)
diff --git
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/SizeFileFilterTest.java
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/SizeFileFilterTest.java
index c37c40c2c..8ff2f301e 100644
---
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/SizeFileFilterTest.java
+++
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/SizeFileFilterTest.java
@@ -19,6 +19,7 @@ package org.apache.commons.vfs2.filter;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.File;
import java.io.IOException;
@@ -102,6 +103,11 @@ public class SizeFileFilterTest extends BaseFilterTest {
zipFileObj = getZipFileObject(zipFile);
}
+ @Test
+ public void testSizeFilterSizeNegative(){
+ assertThrows(IllegalArgumentException.class, () -> new
SizeFileFilter(-1));
+ }
+
@Test
public void testSizeFileFilterLong() throws FileSystemException {
diff --git
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/URIUtilsTest.java
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/URIUtilsTest.java
new file mode 100644
index 000000000..a661dc74b
--- /dev/null
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/util/URIUtilsTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.vfs2.util;
+
+import org.junit.jupiter.api.Test;
+
+import java.nio.charset.StandardCharsets;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+
+class URIUtilsTest {
+
+ @Test
+ void testEncodePathThrowsIllegalArgumentException() {
+ assertThrows(IllegalArgumentException.class, () ->
URIUtils.encodePath(null, StandardCharsets.UTF_8.name()));
+ assertThrows(IllegalArgumentException.class, () ->
URIUtils.encodePath("", ""));
+ }
+
+}
\ No newline at end of file