Update VavrUnitTest.java (#3611)

sample of re-throwing via Try
This commit is contained in:
sleyzerzon 2018-02-24 02:15:23 -05:00 committed by Grzegorz Piwowarek
parent 70fd753e48
commit e21dac0f13
1 changed files with 5 additions and 5 deletions

View File

@ -216,11 +216,11 @@ public class VavrUnitTest {
assertEquals(-1, errorSentinel);
}
// @Test(expected = ArithmeticException.class)
// public void givenBadCode_whenTryHandles_thenCorrect3() {
// Try<Integer> result = Try.of(() -> 1 / 0);
// result.getOrElseThrow(ArithmeticException::new);
// }
@Test(expected = RuntimeException.class)
public void givenBadCode_whenTryHandles_thenCorrect3() {
Try<Integer> result = Try.of(() -> 1 / 0);
result.getOrElseThrow(e->new RuntimeException(e));//re-throw different ex type
}
// lazy
@Test