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
The following commit(s) were added to refs/heads/master by this push: new 3ff59a7 Rewrite test using JUnit 5 APIs. 3ff59a7 is described below commit 3ff59a713a300675c19173f37f45ede331ab48f8 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Mon Jul 12 09:05:22 2021 -0400 Rewrite test using JUnit 5 APIs. --- .../commons/io/output/BrokenOutputStreamTest.java | 49 +++++++--------------- 1 file changed, 15 insertions(+), 34 deletions(-) diff --git a/src/test/java/org/apache/commons/io/output/BrokenOutputStreamTest.java b/src/test/java/org/apache/commons/io/output/BrokenOutputStreamTest.java index 43abaf8..e28e565 100644 --- a/src/test/java/org/apache/commons/io/output/BrokenOutputStreamTest.java +++ b/src/test/java/org/apache/commons/io/output/BrokenOutputStreamTest.java @@ -17,7 +17,7 @@ package org.apache.commons.io.output; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.fail; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.io.IOException; import java.io.OutputStream; @@ -41,47 +41,28 @@ public class BrokenOutputStreamTest { } @Test - public void testWrite() { - try { - stream.write(1); - fail("Expected exception not thrown."); - } catch (final IOException e) { - assertEquals(exception, e); - } + public void testClose() { + assertEquals(exception, assertThrows(IOException.class, () -> stream.close())); + } - try { - stream.write(new byte[1]); - fail("Expected exception not thrown."); - } catch (final IOException e) { - assertEquals(exception, e); - } + @Test + public void testFlush() { + assertEquals(exception, assertThrows(IOException.class, () -> stream.flush())); + } - try { - stream.write(new byte[1], 0, 1); - fail("Expected exception not thrown."); - } catch (final IOException e) { - assertEquals(exception, e); - } + @Test + public void testWriteByteArray() { + assertEquals(exception, assertThrows(IOException.class, () -> stream.write(new byte[1]))); } @Test - public void testFlush() { - try { - stream.flush(); - fail("Expected exception not thrown."); - } catch (final IOException e) { - assertEquals(exception, e); - } + public void testWriteByteArrayIndexed() { + assertEquals(exception, assertThrows(IOException.class, () -> stream.write(new byte[1], 0, 1))); } @Test - public void testClose() { - try { - stream.close(); - fail("Expected exception not thrown."); - } catch (final IOException e) { - assertEquals(exception, e); - } + public void testWriteInt() { + assertEquals(exception, assertThrows(IOException.class, () -> stream.write(1))); } }