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/09/12 21:10:26 UTC

[commons-io] 04/04: Fix test on Java > 8

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

commit a9a477779c9fa2caad2034dbd8a02048a38bafaa
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Sep 12 14:10:17 2022 -0700

    Fix test on Java > 8
---
 src/test/java/org/apache/commons/io/function/IOIteratorTest.java | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/test/java/org/apache/commons/io/function/IOIteratorTest.java b/src/test/java/org/apache/commons/io/function/IOIteratorTest.java
index 47101ca3..bfb3b40e 100644
--- a/src/test/java/org/apache/commons/io/function/IOIteratorTest.java
+++ b/src/test/java/org/apache/commons/io/function/IOIteratorTest.java
@@ -29,6 +29,8 @@ import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.commons.lang3.JavaVersion;
+import org.apache.commons.lang3.SystemUtils;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
@@ -84,8 +86,10 @@ public class IOIteratorTest {
 
     @Test
     public void testRemove() throws IOException {
-        assertThrows(IllegalStateException.class, iterator::remove);
-        assertThrows(IllegalStateException.class, iterator::remove);
+        final Class<? extends Exception> exClass = SystemUtils.isJavaVersionAtMost(JavaVersion.JAVA_1_8) ? IllegalStateException.class
+            : UnsupportedOperationException.class;
+        assertThrows(exClass, iterator::remove);
+        assertThrows(exClass, iterator::remove);
         iterator.next();
         assertThrows(UnsupportedOperationException.class, iterator::remove);
         assertThrows(UnsupportedOperationException.class, iterator::remove);