@Test public void testIsThrowableCausedByOrAssignableFrom() { Exception someException = new DebugTestSomeOtherException(new IOException(new DebugTestGrandChildException(new GeneralSecurityException(new IllegalArgumentException(new InstantiationException()))))); String excMessage = Debug.getEST(someException); try { throw someException; } catch (Exception ex) { assertEquals(null, Debug.getThrowableCausedByOrAssignableFrom(someException, NullPointerException.class, IllegalThreadStateException.class)); assertFalse(Debug.isThrowableCausedByOrAssignableFrom(someException, NullPointerException.class, IllegalThreadStateException.class)); assertEquals(null, Debug.getThrowableCausedByOrAssignableFrom(someException, ArrayIndexOutOfBoundsException.class, StringIndexOutOfBoundsException.class)); assertFalse(Debug.isThrowableCausedByOrAssignableFrom(someException, ArrayIndexOutOfBoundsException.class, StringIndexOutOfBoundsException.class)); assertEquals(DebugTestGrandChildException.class, Debug.getThrowableCausedByOrAssignableFrom(ex, DebugTestGrandChildException.class, NullPointerException.class)); assertTrue(Debug.isThrowableCausedByOrAssignableFrom(ex, DebugTestGrandChildException.class, NullPointerException.class)); assertEquals(DebugTestBaseException.class, Debug.getThrowableCausedByOrAssignableFrom(ex, DebugTestBaseException.class, NullPointerException.class)); assertTrue(Debug.isThrowableCausedByOrAssignableFrom(ex, DebugTestBaseException.class, NullPointerException.class)); assertEquals(null, Debug.getThrowableCausedByOrAssignableFrom(ex, DebugTestGreatGrandChildException.class)); assertFalse(Debug.isThrowableCausedByOrAssignableFrom(ex, DebugTestGreatGrandChildException.class)); assertFalse(Debug.isThrowableCausedByOrAssignableFrom(ex, IllegalThreadStateException.class)); assertFalse(Debug.isThrowableCausedByOrAssignableFrom(ex, ArithmeticException.class)); assertFalse(Debug.isThrowableCausedByOrAssignableFrom(ex, NumberFormatException.class)); assertTrue(Debug.isThrowableCausedByOrAssignableFrom(ex, IOException.class)); assertTrue(Debug.isThrowableCausedByOrAssignableFrom(ex, Exception.class)); assertTrue(Debug.isThrowableCausedByOrAssignableFrom(ex, RuntimeException.class)); assertTrue(Debug.isThrowableCausedByOrAssignableFrom(ex, IllegalThreadStateException.class, ClassCastException.class, DebugTestBaseException.class)); assertTrue(Debug.isThrowableCausedByOrAssignableFrom(ex, DebugTestChildException.class)); assertTrue(Debug.isThrowableCausedByOrAssignableFrom(ex, DebugTestGrandChildException.class)); assertTrue(Debug.isThrowableCausedByOrAssignableFrom(ex, Throwable.class)); assertFalse(Debug.isThrowableCausedByOrAssignableFrom(ex, Error.class)); } }
public static boolean isThrowableCausedByOrAssignableFrom(Throwable exc, Class... causeClasses) { Class throwable = getThrowableCausedByOrAssignableFrom(exc, causeClasses); if (throwable == null) { return false; } return true; }
Debug { public static boolean isThrowableCausedByOrAssignableFrom(Throwable exc, Class... causeClasses) { Class throwable = getThrowableCausedByOrAssignableFrom(exc, causeClasses); if (throwable == null) { return false; } return true; } }
Debug { public static boolean isThrowableCausedByOrAssignableFrom(Throwable exc, Class... causeClasses) { Class throwable = getThrowableCausedByOrAssignableFrom(exc, causeClasses); if (throwable == null) { return false; } return true; }  }
Debug { public static boolean isThrowableCausedByOrAssignableFrom(Throwable exc, Class... causeClasses) { Class throwable = getThrowableCausedByOrAssignableFrom(exc, causeClasses); if (throwable == null) { return false; } return true; }  static double getEpochSeconds(); static long nowMillis(); static String buildRandomString(int nChars, String alphaNum); static String findClassPath(String className, ClassLoader classLoader); static String findClassPath(Class<?> cls, ClassLoader classLoader); static String humanReadableBytes(double val); static String humanReadableBytes(long val); static URL getUrlFromJarName(String jarPathIn); static String humanReadableBytes(String val); static String humanReadableBytes(BigInteger val); static String classLoaderInfo(String className); static String classLoaderInfo(Class<?> cls); static String findClassPath(Class<?> cls); static String findClassPath(String className); static String printClassPaths(String... classNames); static String getThreadStacksString(); static Class getThrowableCausedByOrAssignableFrom(Throwable exc, Class... causeClasses); static boolean isThrowableCausedByOrAssignableFrom(Throwable exc, Class... causeClasses); static String getExtendedStackTrace(Throwable th); static String getEST(Throwable th); static int nCpus(); static long freeMem(); static long totalMem(); static long usedMem(); static long maxMem(); static void gc(); static String showMem(); static String getClassName(Object obj); static String exec(String cmd); static String hostName(); static Object getNull(); static String itoa(BigInteger n, int radix); static String itoa(long l, int radix); static String itoa(int l, int radix); static String getProgName(Class inClass); static String threadName(); static void sleep(int nMillis); static void nop(); }
Debug { public static boolean isThrowableCausedByOrAssignableFrom(Throwable exc, Class... causeClasses) { Class throwable = getThrowableCausedByOrAssignableFrom(exc, causeClasses); if (throwable == null) { return false; } return true; }  static double getEpochSeconds(); static long nowMillis(); static String buildRandomString(int nChars, String alphaNum); static String findClassPath(String className, ClassLoader classLoader); static String findClassPath(Class<?> cls, ClassLoader classLoader); static String humanReadableBytes(double val); static String humanReadableBytes(long val); static URL getUrlFromJarName(String jarPathIn); static String humanReadableBytes(String val); static String humanReadableBytes(BigInteger val); static String classLoaderInfo(String className); static String classLoaderInfo(Class<?> cls); static String findClassPath(Class<?> cls); static String findClassPath(String className); static String printClassPaths(String... classNames); static String getThreadStacksString(); static Class getThrowableCausedByOrAssignableFrom(Throwable exc, Class... causeClasses); static boolean isThrowableCausedByOrAssignableFrom(Throwable exc, Class... causeClasses); static String getExtendedStackTrace(Throwable th); static String getEST(Throwable th); static int nCpus(); static long freeMem(); static long totalMem(); static long usedMem(); static long maxMem(); static void gc(); static String showMem(); static String getClassName(Object obj); static String exec(String cmd); static String hostName(); static Object getNull(); static String itoa(BigInteger n, int radix); static String itoa(long l, int radix); static String itoa(int l, int radix); static String getProgName(Class inClass); static String threadName(); static void sleep(int nMillis); static void nop();  }