Interface NamedExecutable

All Superinterfaces:
Executable, Named<Executable>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface @API(status=EXPERIMENTAL, since="5.11") public interface NamedExecutable extends Named<Executable>, Executable
NamedExecutable joins Executable and Named in a one self-typed functional interface.

The default implementation of getName() returns the result of calling Object.toString() on the implementing instance but may be overridden by concrete implementations to provide a more meaningful name.

On Java 16 or later, it is recommended to implement this interface using a record type.

Since:
5.11
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default String
    Get the name of the payload.
    default Executable
    Get the payload.

    Methods inherited from interface org.junit.jupiter.api.function.Executable

    execute
  • Method Details

    • getName

      default String getName()
      Description copied from interface: Named
      Get the name of the payload.
      Specified by:
      getName in interface Named<Executable>
      Returns:
      the name of the payload; never null or blank
    • getPayload

      default Executable getPayload()
      Description copied from interface: Named
      Get the payload.
      Specified by:
      getPayload in interface Named<Executable>
      Returns:
      the payload; may be null depending on the use case