T - the type of the payload@API(status=STABLE,
since="5.8")
public interface Named<T>
Named is a container that associates a name with a given payload.| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getName()
Get the name of the payload.
|
T |
getPayload()
Get the payload.
|
static <T> Named<T> |
named(java.lang.String name,
T payload)
Factory method for creating an instance of
Named based on a
name and a payload. |
static <T> Named<T> |
of(java.lang.String name,
T payload)
Factory method for creating an instance of
Named based on a
name and a payload. |
static <T> Named<T> of(java.lang.String name, T payload)
Named based on a
name and a payload.T - the type of the payloadname - the name associated with the payload; never null or
blankpayload - the object that serves as the payload; may be null
depending on the use caseNamed; never nullnamed(String, java.lang.Object)static <T> Named<T> named(java.lang.String name, T payload)
Named based on a
name and a payload.
This method is an alias for of(java.lang.String, T) and is
intended to be used when statically imported — for example, via:
import static org.junit.jupiter.api.Named.named;
T - the type of the payloadname - the name associated with the payload; never null or
blankpayload - the object that serves as the payload; may be null
depending on the use caseNamed; never nulljava.lang.String getName()
null or blankT getPayload()
null depending on the use case