Top Description Methods
org.junit.jupiter.api.function

public Interface Executable

Known Direct Subinterfaces
org.junit.jupiter.api.NamedExecutable
Annotations
@FunctionalInterface
@API
status:STABLE
since:5.0
Static Imports
org.apiguardian.api.API.Status.STABLE

Executable is a functional interface that can be used to implement any generic block of code that potentially throws a Throwable.

The Executable interface is similar to java.lang.Runnable, except that an Executable can throw any kind of exception.

Rationale for throwing Throwable instead of Exception

Although Java applications typically throw exceptions that are instances of java.lang.Exception, java.lang.RuntimeException, java.lang.Error, or java.lang.AssertionError (in testing scenarios), there may be use cases where an Executable needs to explicitly throw a Throwable. In order to support such specialized use cases, execute() is declared to throw Throwable.

Since
5.0
See Also
org.junit.jupiter.api.Assertions#assertAll(Executable...), org.junit.jupiter.api.Assertions#assertAll(String, Executable...), org.junit.jupiter.api.Assertions#assertThrows(Class, Executable), org.junit.jupiter.api.Assumptions#assumingThat(java.util.function.BooleanSupplier, Executable), org.junit.jupiter.api.DynamicTest#dynamicTest(String, Executable), ThrowingConsumer, ThrowingSupplier

Method Summary

Modifier and TypeMethod and Description
public void

Method Detail

executeback to summary
public void execute() throws Throwable