From 07730c44f0a54700b7ab6a98721f4c2cae2618bb Mon Sep 17 00:00:00 2001 From: mobounya Date: Fri, 19 Jan 2024 20:39:03 +0100 Subject: [PATCH] Introduce new interface NamedExecutable Introduce new interface NamedExecutable that associates a name, a payload and an Executable. This was introduced to help colocate test's diplayName, payload, and testExecutor in one place. Concrete usage of this interface is in the next commit. Issue: #3261 --- .../junit/jupiter/api/NamedExecutable.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 junit-jupiter-api/src/main/java/org/junit/jupiter/api/NamedExecutable.java diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/NamedExecutable.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/NamedExecutable.java new file mode 100644 index 00000000000..295691609f2 --- /dev/null +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/NamedExecutable.java @@ -0,0 +1,32 @@ +/* + * Copyright 2015-2024 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.EXPERIMENTAL; + +import org.apiguardian.api.API; +import org.junit.jupiter.api.function.Executable; + +/** + * {@code NamedExecutable} is a container that associates a name, a payload and an + * {@link Executable} + * + * @param the type of the payload + * + * @since 5.11 + */ +@API(status = EXPERIMENTAL, since = "5.11") +public interface NamedExecutable> extends Named, Executable { + @Override + default String getName() { + return toString(); + } +}