@Test public void unwrap() { RuntimeException re = new RuntimeException("my runtime"); assertThat(ExceptionUtil.unwrap(re)).isSameAs(re); ExecutionException ee = new ExecutionException(re); assertThat(ExceptionUtil.unwrap(ee)).isSameAs(re); InvocationTargetException ie = new InvocationTargetException(re); assertThat(ExceptionUtil.unwrap(ie)).isSameAs(re); Exception e = new Exception("my exception"); ExecutionException ee2 = new ExecutionException(e); try { ExceptionUtil.unwrapAndUnchecked(ee2); } catch (Throwable t) { assertThat(t).isInstanceOf(UncheckedException.class).hasCauseExactlyInstanceOf(Exception.class); } }
public static Throwable unwrap(@Nullable Throwable t) { if (t instanceof UncheckedException || t instanceof java.util.concurrent.ExecutionException || t instanceof java.lang.reflect.InvocationTargetException || t instanceof UndeclaredThrowableException) { return t.getCause(); } return t; }
ExceptionUtil { public static Throwable unwrap(@Nullable Throwable t) { if (t instanceof UncheckedException || t instanceof java.util.concurrent.ExecutionException || t instanceof java.lang.reflect.InvocationTargetException || t instanceof UndeclaredThrowableException) { return t.getCause(); } return t; } }
ExceptionUtil { public static Throwable unwrap(@Nullable Throwable t) { if (t instanceof UncheckedException || t instanceof java.util.concurrent.ExecutionException || t instanceof java.lang.reflect.InvocationTargetException || t instanceof UndeclaredThrowableException) { return t.getCause(); } return t; }  }
ExceptionUtil { public static Throwable unwrap(@Nullable Throwable t) { if (t instanceof UncheckedException || t instanceof java.util.concurrent.ExecutionException || t instanceof java.lang.reflect.InvocationTargetException || t instanceof UndeclaredThrowableException) { return t.getCause(); } return t; }  static RuntimeException unchecked(@Nullable Throwable t); static Throwable unwrap(@Nullable Throwable t); static RuntimeException unwrapAndUnchecked(@Nullable Throwable t); static String stackTraceText(@NotNull Throwable t); static String toStringWithShortName(@Nullable Throwable t); static String toStringWithRootCause(@Nullable Throwable t); static Throwable getRootCause(@NotNull Throwable t); static T findCause(@NotNull Throwable throwable, Class<T> cause); @SuppressWarnings("unchecked") static boolean isCausedBy(@Nullable Throwable throwable,
			Class<? extends Exception>... causeExceptionClasses); static T setStackTrace(@NotNull T throwable, Class<?> throwClass, String throwClazz); static T clearStackTrace(@NotNull T throwable); }
ExceptionUtil { public static Throwable unwrap(@Nullable Throwable t) { if (t instanceof UncheckedException || t instanceof java.util.concurrent.ExecutionException || t instanceof java.lang.reflect.InvocationTargetException || t instanceof UndeclaredThrowableException) { return t.getCause(); } return t; }  static RuntimeException unchecked(@Nullable Throwable t); static Throwable unwrap(@Nullable Throwable t); static RuntimeException unwrapAndUnchecked(@Nullable Throwable t); static String stackTraceText(@NotNull Throwable t); static String toStringWithShortName(@Nullable Throwable t); static String toStringWithRootCause(@Nullable Throwable t); static Throwable getRootCause(@NotNull Throwable t); static T findCause(@NotNull Throwable throwable, Class<T> cause); @SuppressWarnings("unchecked") static boolean isCausedBy(@Nullable Throwable throwable,
			Class<? extends Exception>... causeExceptionClasses); static T setStackTrace(@NotNull T throwable, Class<?> throwClass, String throwClazz); static T clearStackTrace(@NotNull T throwable);  }