Package com._1c.g5.v8.dt.internal.form
Class ExtraAssertThrows
java.lang.Object
com._1c.g5.v8.dt.internal.form.ExtraAssertThrows
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 Summary
Modifier and TypeMethodDescriptionstatic final <T extends Throwable>
TassertThrows
(Class<T> expectedType, Runnable runnable) Asserts that execution of the runnable throws an expected type of exception and returns the exception.
-
Method Details
-
assertThrows
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
.
-