Class ExtraAssertThrows

java.lang.Object
com._1c.g5.v8.dt.internal.form.ExtraAssertThrows

public final class ExtraAssertThrows extends Object
Represents an useful assertion methods to check an exception of an expected type is thrown in case of using JUnit 4.

Please use JUnit 5 'assertThrows' methods, if possible, to assert an exception is thrown.

  • Method Details

    • assertThrows

      public static final <T extends Throwable> T assertThrows(Class<T> expectedType, Runnable runnable)
      Asserts that execution of the runnable throws an expected type of exception and returns the exception.
      Type Parameters:
      T - The generalized type that extends Throwable.
      Parameters:
      expectedType - The class of expected exception.
      runnable - The code that potentially throws the expected exception.
      Returns:
      The exception if was; otherwice fails by AssertionError.