diff --git a/pom.xml b/pom.xml index 95ebfe1b8..e7ad9cff2 100644 --- a/pom.xml +++ b/pom.xml @@ -117,7 +117,7 @@ The MIT License (MIT) diff --git a/src/test/java/org/cactoos/BytesTest.java b/src/test/java/org/cactoos/BytesTest.java index 04ebb13c0..2cd737c11 100644 --- a/src/test/java/org/cactoos/BytesTest.java +++ b/src/test/java/org/cactoos/BytesTest.java @@ -24,7 +24,9 @@ package org.cactoos; import org.cactoos.bytes.NoNulls; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import org.llorllale.cactoos.matchers.Assertion; +import org.llorllale.cactoos.matchers.Throws; /** * Test case for {@link NoNulls}. @@ -33,14 +35,20 @@ */ public final class BytesTest { - @Test(expected = IllegalArgumentException.class) public void failForNullArgument() throws Exception { - new NoNulls(null).asBytes(); + new Assertion<>( + "Must fail for null argument.", + () -> new NoNulls(null).asBytes(), + new Throws<>(IllegalArgumentException.class) + ).affirm(); } - @Test(expected = IllegalStateException.class) public void failForNullResult() throws Exception { - new NoNulls(() -> null).asBytes(); + new Assertion<>( + "Must fail for null result.", + () -> new NoNulls(() -> null).asBytes(), + new Throws<>(IllegalStateException.class) + ).affirm(); } @Test diff --git a/src/test/java/org/cactoos/bytes/HexOfTest.java b/src/test/java/org/cactoos/bytes/HexOfTest.java index 0d89076ba..6af634228 100644 --- a/src/test/java/org/cactoos/bytes/HexOfTest.java +++ b/src/test/java/org/cactoos/bytes/HexOfTest.java @@ -27,8 +27,9 @@ import java.io.IOException; import org.cactoos.text.TextOf; import org.hamcrest.core.IsEqual; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.llorllale.cactoos.matchers.Assertion; +import org.llorllale.cactoos.matchers.Throws; import org.llorllale.cactoos.matchers.Verifies; /** @@ -37,6 +38,7 @@ * @since 0.29 * @checkstyle MagicNumberCheck (500 line) * @checkstyle JavadocMethodCheck (500 line) + * @checkstyle ClassDataAbstractionCouplingCheck (500 lines) */ public final class HexOfTest { @@ -66,13 +68,19 @@ public void validHex() throws Exception { ).affirm(); } - @Test(expected = IOException.class) public void invalidHexLength() throws Exception { - new HexOf(new TextOf("ABF")).asBytes(); + new Assertion<>( + "Must invalid hex length", + () -> new HexOf(new TextOf("ABF")).asBytes(), + new Throws<>(IOException.class) + ).affirm(); } - @Test(expected = IOException.class) public void invalidHex() throws Exception { - new HexOf(new TextOf("ABG!")).asBytes(); + new Assertion<>( + "Must invalid hex", + () -> new HexOf(new TextOf("ABG!")).asBytes(), + new Throws<>(IOException.class) + ).affirm(); } } diff --git a/src/test/java/org/cactoos/bytes/ReaderAsBytesTest.java b/src/test/java/org/cactoos/bytes/ReaderAsBytesTest.java index 523275767..99bf7f6cd 100644 --- a/src/test/java/org/cactoos/bytes/ReaderAsBytesTest.java +++ b/src/test/java/org/cactoos/bytes/ReaderAsBytesTest.java @@ -26,7 +26,7 @@ import java.io.StringReader; import org.cactoos.text.TextOf; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.TemporaryFolder; import org.llorllale.cactoos.matchers.Assertion; import org.llorllale.cactoos.matchers.IsText; diff --git a/src/test/java/org/cactoos/bytes/UncheckedBytesTest.java b/src/test/java/org/cactoos/bytes/UncheckedBytesTest.java index 263f3aebd..b91897bd2 100644 --- a/src/test/java/org/cactoos/bytes/UncheckedBytesTest.java +++ b/src/test/java/org/cactoos/bytes/UncheckedBytesTest.java @@ -27,8 +27,9 @@ import org.cactoos.Text; import org.cactoos.text.TextOf; import org.hamcrest.core.IsEqual; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.llorllale.cactoos.matchers.Assertion; +import org.llorllale.cactoos.matchers.Throws; /** * Test case for {@link UncheckedBytes}. @@ -38,13 +39,17 @@ */ public final class UncheckedBytesTest { - @Test(expected = RuntimeException.class) + @Test public void rethrowsCheckedToUncheckedException() { - new UncheckedBytes( - () -> { - throw new IOException("intended"); - } - ).asBytes(); + new Assertion<>( + "Must rethrow checked to unchecked exception", + () -> new UncheckedBytes( + () -> { + throw new IOException("intended"); + } + ).asBytes(), + new Throws<>(RuntimeException.class) + ).affirm(); } @Test