|
20 | 20 | import static org.junit.jupiter.api.Assertions.assertFalse; |
21 | 21 | import static org.junit.jupiter.api.Assertions.assertNotNull; |
22 | 22 | import static org.junit.jupiter.api.Assertions.assertNull; |
| 23 | +import static org.junit.jupiter.api.Assertions.assertThrows; |
23 | 24 | import static org.junit.jupiter.api.Assertions.assertTrue; |
24 | 25 | import static org.junit.jupiter.api.Assertions.fail; |
25 | 26 | import static org.junit.jupiter.api.Assumptions.assumeFalse; |
@@ -408,18 +409,8 @@ public void testMarkResetBeforeReadWithoutBOM() throws Exception { |
408 | 409 | @Test |
409 | 410 | public void testNoBoms() throws Exception { |
410 | 411 | 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()); |
423 | 414 | } |
424 | 415 |
|
425 | 416 | @Test |
|
0 commit comments