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/06/09 15:55:17 UTC

[commons-io] 01/06: Migrate from JUnit 4 to 5

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 a3f9c8e97a3463b76a2ccb0adaba246388244553
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Jun 9 10:01:54 2022 -0400

    Migrate from JUnit 4 to 5
---
 .../org/apache/commons/io/input/BOMInputStreamTest.java   | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/src/test/java/org/apache/commons/io/input/BOMInputStreamTest.java b/src/test/java/org/apache/commons/io/input/BOMInputStreamTest.java
index 44d09247..8de11101 100644
--- a/src/test/java/org/apache/commons/io/input/BOMInputStreamTest.java
+++ b/src/test/java/org/apache/commons/io/input/BOMInputStreamTest.java
@@ -20,6 +20,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.junit.jupiter.api.Assertions.fail;
 import static org.junit.jupiter.api.Assumptions.assumeFalse;
@@ -408,18 +409,8 @@ public class BOMInputStreamTest {
     @Test
     public void testNoBoms() throws Exception {
         final byte[] data = { 'A', 'B', 'C' };
-        try {
-            new BOMInputStream(createUtf8DataStream(data, true), false, (ByteOrderMark[])null).close();
-            fail("Null BOMs, expected IllegalArgumentException");
-        } catch (final IllegalArgumentException e) {
-            // expected
-        }
-        try {
-            new BOMInputStream(createUtf8DataStream(data, true), false, new ByteOrderMark[0]).close();
-            fail("Null BOMs, expected IllegalArgumentException");
-        } catch (final IllegalArgumentException e) {
-            // expected
-        }
+        assertThrows(IllegalArgumentException.class, () -> new BOMInputStream(createUtf8DataStream(data, true), false, (ByteOrderMark[])null).close());
+        assertThrows(IllegalArgumentException.class, () -> new BOMInputStream(createUtf8DataStream(data, true), false, new ByteOrderMark[0]).close());
     }
 
     @Test