Search in sources :

Example 11 with Throws

use of org.llorllale.cactoos.matchers.Throws in project cactoos by yegor256.

the class IoCheckedProcTest method rethrowsIoException.

@Test
void rethrowsIoException() {
    final IOException exception = new IOException("intended");
    new Assertion<>("Must rethrow original IOException", () -> {
        new IoCheckedProc<>((Proc<Integer>) i -> {
            throw exception;
        }).exec(1);
        return null;
    }, new Throws<>(exception.getMessage(), exception.getClass())).affirm();
}
Also used : Test(org.junit.jupiter.api.Test) Assertion(org.llorllale.cactoos.matchers.Assertion) IOException(java.io.IOException) Proc(org.cactoos.Proc) Throws(org.llorllale.cactoos.matchers.Throws) IOException(java.io.IOException) Throws(org.llorllale.cactoos.matchers.Throws) Test(org.junit.jupiter.api.Test)

Aggregations

Throws (org.llorllale.cactoos.matchers.Throws)11 IOException (java.io.IOException)8 Test (org.junit.jupiter.api.Test)8 Assertion (org.llorllale.cactoos.matchers.Assertion)5 Test (org.junit.Test)3 IsEqual (org.hamcrest.core.IsEqual)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 InputStream (java.io.InputStream)1 AcceptPendingException (java.nio.channels.AcceptPendingException)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 PatternSyntaxException (java.util.regex.PatternSyntaxException)1 Proc (org.cactoos.Proc)1 Text (org.cactoos.Text)1 IoCheckedBiFunc (org.cactoos.func.IoCheckedBiFunc)1 IterableOf (org.cactoos.iterable.IterableOf)1 FormattedText (org.cactoos.text.FormattedText)1 Randomized (org.cactoos.text.Randomized)1 Matchers (org.hamcrest.Matchers)1