Skip to content

Commit 921f53c

Browse files
author
Gerald Unterrainer
committed
update tests
1 parent 22e889b commit 921f53c

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed
Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
package info.unterrainer.commons.jreutils;
22

3+
import static org.junit.jupiter.api.Assertions.assertThrows;
4+
import static org.junit.jupiter.api.Assertions.assertTrue;
5+
36
import org.junit.jupiter.api.Test;
47

58
public class ExceptionsTests {
69

710
@Test
8-
public void BeforeTest() {
11+
public void codeBeforeTest() {
912
try {
1013
// Some method you don't have control over throwing an exception.
1114
throw new IllegalArgumentException();
@@ -15,9 +18,18 @@ public void BeforeTest() {
1518
}
1619

1720
@Test
18-
public void AfterTest() {
21+
public void throwsExceptionWithoutSwallow() {
22+
assertThrows(IllegalArgumentException.class, () -> {
23+
// Some method you don't have control over throwing an exception.
24+
throw new IllegalArgumentException();
25+
});
26+
}
27+
28+
@Test
29+
public void swallowsException() {
1930
Exceptions.swallow(() -> {
2031
throw new IllegalArgumentException();
2132
}, IllegalArgumentException.class, NumberFormatException.class);
33+
assertTrue(true);
2234
}
2335
}

0 commit comments

Comments
 (0)