Skip to content

Commit

Permalink
(yegor256#1396) Use Throws instead of try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
andreoss committed Jul 15, 2020
1 parent f3a3474 commit f62ee64
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/test/java/org/cactoos/func/IoCheckedBiFuncTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
package org.cactoos.func;

import java.io.IOException;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.llorllale.cactoos.matchers.Assertion;
import org.llorllale.cactoos.matchers.Throws;

/**
* Test case for {@link IoCheckedBiFunc}.
Expand All @@ -38,19 +38,18 @@ public final class IoCheckedBiFuncTest {
@Test
public void rethrowsIoException() {
final IOException exception = new IOException("intended");
try {
new IoCheckedBiFunc<>(
(fst, scd) -> {
throw exception;
}
).apply(1, 2);
} catch (final IOException ex) {
new Assertion<>(
"",
ex,
Matchers.is(exception)
"Must rethrow IOException",
() -> new IoCheckedBiFunc<>(
(fst, scd) -> {
throw exception;
}
).apply(1, 2),
new Throws<>(
exception.getMessage(),
exception.getClass()
)
).affirm();
}
}

@Test(expected = IOException.class)
Expand Down

0 comments on commit f62ee64

Please sign in to comment.