@Test public void throwExceptionOrError() { try { ExceptionUtil.throwExceptionOrError(new Exception("test")); fail(); } catch (Exception e) { assertEquals("test", e.getMessage()); } try { ExceptionUtil.throwExceptionOrError(new RuntimeException("test")); fail(); } catch (RuntimeException e) { assertEquals("test", e.getMessage()); } catch (Exception e) { fail(); } try { ExceptionUtil.throwExceptionOrError(new Error("test")); fail(); } catch (Error e) { assertEquals("test", e.getMessage()); } catch (Exception e) { fail(); } }
public static void throwExceptionOrError(Throwable throwable) throws Exception { if (throwable instanceof Exception) { throw (Exception) throwable; } if (throwable instanceof Error) { throw (Error) throwable; } throw new RuntimeException(throwable); }
ExceptionUtil { public static void throwExceptionOrError(Throwable throwable) throws Exception { if (throwable instanceof Exception) { throw (Exception) throwable; } if (throwable instanceof Error) { throw (Error) throwable; } throw new RuntimeException(throwable); } }
ExceptionUtil { public static void throwExceptionOrError(Throwable throwable) throws Exception { if (throwable instanceof Exception) { throw (Exception) throwable; } if (throwable instanceof Error) { throw (Error) throwable; } throw new RuntimeException(throwable); }  }
ExceptionUtil { public static void throwExceptionOrError(Throwable throwable) throws Exception { if (throwable instanceof Exception) { throw (Exception) throwable; } if (throwable instanceof Error) { throw (Error) throwable; } throw new RuntimeException(throwable); }  static boolean causedBy(Throwable throwable, Class<? extends Throwable> causeType); static Throwable getRootCause(Throwable throwable); static List<Throwable> getCauses(Throwable throwable); static List<Throwable> getCauses(Throwable throwable, boolean reversed); static RuntimeException toRuntimeException(Exception exception); static RuntimeException toRuntimeException(Exception exception,
            Class<? extends RuntimeException> runtimeExceptionClass); static void throwExceptionOrError(Throwable throwable); static void throwRuntimeExceptionOrError(Throwable throwable); static String getStackTrace(Throwable throwable); }
ExceptionUtil { public static void throwExceptionOrError(Throwable throwable) throws Exception { if (throwable instanceof Exception) { throw (Exception) throwable; } if (throwable instanceof Error) { throw (Error) throwable; } throw new RuntimeException(throwable); }  static boolean causedBy(Throwable throwable, Class<? extends Throwable> causeType); static Throwable getRootCause(Throwable throwable); static List<Throwable> getCauses(Throwable throwable); static List<Throwable> getCauses(Throwable throwable, boolean reversed); static RuntimeException toRuntimeException(Exception exception); static RuntimeException toRuntimeException(Exception exception,
            Class<? extends RuntimeException> runtimeExceptionClass); static void throwExceptionOrError(Throwable throwable); static void throwRuntimeExceptionOrError(Throwable throwable); static String getStackTrace(Throwable throwable);  }