Class AssertThrowsAny

java.lang.Object
org.soliscode.test.assertions.AssertThrowsAny

public final class AssertThrowsAny extends Object
A collection of utility methods that support asserting that an executable throws one of a list of exception types.
Since:
1.0
Author:
evanbergstrom
  • Method Details

    • assertThrowsAny

      public static void assertThrowsAny(@NotNull @NotNull Collection<Class<? extends Throwable>> expectedTypes, @NotNull @NotNull org.junit.jupiter.api.function.Executable executable)
      Asserts that the executable will throw one of a list of possible exception types.
      Parameters:
      expectedTypes - the exception types that the executable should throw.
      executable - the executable to test.
    • assertThrowsAny

      public static void assertThrowsAny(@NotNull @NotNull Collection<Class<? extends Throwable>> expectedTypes, @NotNull @NotNull org.junit.jupiter.api.function.Executable executable, String message)
      Asserts that the executable will throw one of a list of possible exception types.
      Parameters:
      expectedTypes - the exception types that the executable should throw.
      executable - the executable to test.
      message - the message to include in the exception if the assertions fails.
    • assertThrowsAny

      public static void assertThrowsAny(@NotNull @NotNull Collection<Class<? extends Throwable>> expectedTypes, @NotNull @NotNull org.junit.jupiter.api.function.Executable executable, Supplier<String> messageSupplier)
      Asserts that the executable will throw one of a list of possible exception types.
      Parameters:
      expectedTypes - the exception types that the executable should throw.
      executable - the executable to test.
      messageSupplier - the supplier of the message to include in the exception if the assertions fails.