Skip to content

Commit a3f9c8e

Browse files
committed
Migrate from JUnit 4 to 5
1 parent 5dfe7fa commit a3f9c8e

1 file changed

Lines changed: 3 additions & 12 deletions

File tree

src/test/java/org/apache/commons/io/input/BOMInputStreamTest.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import static org.junit.jupiter.api.Assertions.assertFalse;
2121
import static org.junit.jupiter.api.Assertions.assertNotNull;
2222
import static org.junit.jupiter.api.Assertions.assertNull;
23+
import static org.junit.jupiter.api.Assertions.assertThrows;
2324
import static org.junit.jupiter.api.Assertions.assertTrue;
2425
import static org.junit.jupiter.api.Assertions.fail;
2526
import static org.junit.jupiter.api.Assumptions.assumeFalse;
@@ -408,18 +409,8 @@ public void testMarkResetBeforeReadWithoutBOM() throws Exception {
408409
@Test
409410
public void testNoBoms() throws Exception {
410411
final byte[] data = { 'A', 'B', 'C' };
411-
try {
412-
new BOMInputStream(createUtf8DataStream(data, true), false, (ByteOrderMark[])null).close();
413-
fail("Null BOMs, expected IllegalArgumentException");
414-
} catch (final IllegalArgumentException e) {
415-
// expected
416-
}
417-
try {
418-
new BOMInputStream(createUtf8DataStream(data, true), false, new ByteOrderMark[0]).close();
419-
fail("Null BOMs, expected IllegalArgumentException");
420-
} catch (final IllegalArgumentException e) {
421-
// expected
422-
}
412+
assertThrows(IllegalArgumentException.class, () -> new BOMInputStream(createUtf8DataStream(data, true), false, (ByteOrderMark[])null).close());
413+
assertThrows(IllegalArgumentException.class, () -> new BOMInputStream(createUtf8DataStream(data, true), false, new ByteOrderMark[0]).close());
423414
}
424415

425416
@Test

0 commit comments

Comments
 (0)