File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
src/test/java/com/nordstrom/common/base Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .nordstrom .common .base ;
2+
3+ import java .io .IOException ;
4+
5+ import org .testng .annotations .Test ;
6+
7+ public class UncheckedThrowTest {
8+
9+ @ Test (expectedExceptions = {IOException .class })
10+ public void testCheckedException () {
11+ try {
12+ throwCheckedException ();
13+ } catch (Throwable t ) {
14+ throw UncheckedThrow .throwUnchecked (t );
15+ }
16+ }
17+
18+ @ Test (expectedExceptions = {AssertionError .class })
19+ public void testUncheckedException () {
20+ try {
21+ throwUncheckedException ();
22+ } catch (Throwable t ) {
23+ throw UncheckedThrow .throwUnchecked (t );
24+ }
25+ }
26+
27+ private void throwCheckedException () throws IOException {
28+ throw new IOException ("This is a checked exception" );
29+ }
30+
31+ private void throwUncheckedException () {
32+ throw new AssertionError ("This is an unchecked exception" );
33+ }
34+
35+ }
You can’t perform that action at this time.
0 commit comments