Package org.junit.jupiter.api
Interface Named<T>
-
- Type Parameters:
T- the type of the payload
- All Known Subinterfaces:
NamedExecutable
@API(status=STABLE, since="5.8") public interface Named<T>Namedis a container that associates a name with a given payload.- Since:
- 5.8
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.StringgetName()Get the name of the payload.TgetPayload()Get the payload.static <T> Named<T>named(java.lang.String name, T payload)Factory method for creating an instance ofNamedbased on anameand apayload.static <T> Named<T>of(java.lang.String name, T payload)Factory method for creating an instance ofNamedbased on anameand apayload.
-
-
-
Method Detail
-
of
static <T> Named<T> of(java.lang.String name, T payload)
Factory method for creating an instance ofNamedbased on anameand apayload.- Type Parameters:
T- the type of the payload- Parameters:
name- the name associated with the payload; nevernullor blankpayload- the object that serves as the payload; may benulldepending on the use case- Returns:
- an instance of
Named; nevernull - See Also:
named(String, java.lang.Object)
-
named
static <T> Named<T> named(java.lang.String name, T payload)
Factory method for creating an instance ofNamedbased on anameand apayload.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;- Type Parameters:
T- the type of the payload- Parameters:
name- the name associated with the payload; nevernullor blankpayload- the object that serves as the payload; may benulldepending on the use case- Returns:
- an instance of
Named; nevernull
-
getName
java.lang.String getName()
Get the name of the payload.- Returns:
- the name of the payload; never
nullor blank
-
getPayload
T getPayload()
Get the payload.- Returns:
- the payload; may be
nulldepending on the use case
-
-