Top Description Methods
org.junit.jupiter.api

public Interface Named<T extends @Nullable Object>

Known Direct Subinterfaces
org.junit.jupiter.api.NamedExecutable
Annotations
@API
status:STABLE
since:5.8
Type Parameters
<T>
the type of the payload
Static Imports
org.apiguardian.api.API.Status.STABLE

Named is a container that associates a name with a given payload.
Since
5.8

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the name of the payload; never null or blank
getName
()

Get the name of the payload.

public T

Returns:

the payload; may be null depending on the use case
getPayload
()

Get the payload.

public static <
the type of the payload
T extends @Nullable Object
>
Named<T>

Returns:

an instance of Named; never null
named
(String
the name associated with the payload; never null or blank
name
,
T
the object that serves as the payload; may be null depending on the use case
payload
)

Factory method for creating an instance of Named based on a name and a payload.

public static <
the type of the payload
T extends @Nullable Object
>
Named<T>

Returns:

an instance of Named; never null
of
(String
the name associated with the payload; never null or blank
name
,
T
the object that serves as the payload; may be null depending on the use case
payload
)

Factory method for creating an instance of Named based on a name and a payload.

Method Detail

getNameback to summary
public String getName()

Get the name of the payload.

Returns:String

the name of the payload; never null or blank

getPayloadback to summary
public T getPayload()

Get the payload.

Returns:T

the payload; may be null depending on the use case

namedback to summary
public static <T extends @Nullable Object> Named<T> named(String name, T payload)

Factory method for creating an instance of Named based on a name and a payload.

This method is an alias for Named#of and is intended to be used when statically imported — for example, via: import static org.junit.jupiter.api.Named.named;

Parameters
<T>
the type of the payload
name:String

the name associated with the payload; never null or blank

payload:T

the object that serves as the payload; may be null depending on the use case

Returns:Named<T>

an instance of Named; never null

ofback to summary
public static <T extends @Nullable Object> Named<T> of(String name, T payload)

Factory method for creating an instance of Named based on a name and a payload.

Parameters
<T>
the type of the payload
name:String

the name associated with the payload; never null or blank

payload:T

the object that serves as the payload; may be null depending on the use case

Returns:Named<T>

an instance of Named; never null

See Also
named(String, java.lang.Object)