forked from junit-team/junit-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNamedExecutable.java
More file actions
47 lines (41 loc) · 1.31 KB
/
NamedExecutable.java
File metadata and controls
47 lines (41 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* Copyright 2015-2025 the original author or authors.
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v2.0 which
* accompanies this distribution and is available at
*
* https://www.eclipse.org/legal/epl-v20.html
*/
package org.junit.jupiter.api;
import static org.apiguardian.api.API.Status.MAINTAINED;
import java.util.Iterator;
import java.util.stream.Stream;
import org.apiguardian.api.API;
import org.junit.jupiter.api.function.Executable;
/**
* {@code NamedExecutable} joins {@code Executable} and {@code Named} in a
* one self-typed functional interface.
*
* <p>The default implementation of {@link #getName()} returns the result of
* calling {@link Object#toString()} on the implementing instance but may be
* overridden by concrete implementations to provide a more meaningful name.
*
* <p>It is recommended to implement this interface using a record type.
*
* @since 5.11
* @see DynamicTest#stream(Stream)
* @see DynamicTest#stream(Iterator)
*/
@API(status = MAINTAINED, since = "5.13.3")
@FunctionalInterface
public interface NamedExecutable extends Named<Executable>, Executable {
@Override
default String getName() {
return toString();
}
@Override
default Executable getPayload() {
return this;
}
}