Class ExceptionHelper

java.lang.Object
org.sgrewritten.stargate.util.ExceptionHelper

public class ExceptionHelper extends Object
  • Method Details

    • doesThrow

      public static <T extends Throwable> boolean doesThrow(Class<T> expectedType, Runnable runnable)
      Type Parameters:
      T -

      Any throwable

      Parameters:
      expectedType -

      The expected type of the exception

      runnable -

      The function to be run

      Returns:

      True if the exception got thrown

    • doesNotThrow

      public static <T extends Throwable> boolean doesNotThrow(Class<T> expectedType, Runnable runnable)
      Type Parameters:
      T -

      The expected type to not throw

      Parameters:
      expectedType -

      The expected type to not throw

      runnable -

      A function to run

      Returns:

      True if the expected type did not throw

    • doesNotThrow

      public static boolean doesNotThrow(Runnable runnable)
      Parameters:
      runnable -

      The runnable to check if it throws

      Returns:

      True if runnable did not throw any exception