| 1 | /* |
| 2 | * Copyright 2015-2024 the original author or authors. |
| 3 | * |
| 4 | * All rights reserved. This program and the accompanying materials are |
| 5 | * made available under the terms of the Eclipse Public License v2.0 which |
| 6 | * accompanies this distribution and is available at |
| 7 | * |
| 8 | * https://www.eclipse.org/legal/epl-v20.html |
| 9 | */ |
| 10 | |
| 11 | package org.junit.jupiter.api; |
| 12 | |
| 13 | import static org.apiguardian.api.API.Status.STABLE; |
| 14 | |
| 15 | import java.lang.annotation.Documented; |
| 16 | import java.lang.annotation.ElementType; |
| 17 | import java.lang.annotation.Retention; |
| 18 | import java.lang.annotation.RetentionPolicy; |
| 19 | import java.lang.annotation.Target; |
| 20 | |
| 21 | import org.apiguardian.api.API; |
| 22 | |
| 23 | /** |
| 24 | * {@code @DisplayName} is used to declare a {@linkplain #value custom display |
| 25 | * name} for the annotated test class or test method. |
| 26 | * |
| 27 | * <p>Display names are typically used for test reporting in IDEs and build |
| 28 | * tools and may contain spaces, special characters, and even emoji. |
| 29 | * |
| 30 | * @since 5.0 |
| 31 | * @see Test |
| 32 | * @see Tag |
| 33 | * @see TestInfo |
| 34 | * @see DisplayNameGeneration |
| 35 | * @see DisplayNameGenerator |
| 36 | */ |
| 37 | @Target({ ElementType.TYPE, ElementType.METHOD }) |
| 38 | @Retention(RetentionPolicy.RUNTIME) |
| 39 | @Documented |
| 40 | @API(status = STABLE, since = "5.0") |
| 41 | public @interface DisplayName { |
| 42 | |
| 43 | /** |
| 44 | * Custom display name for the annotated class or method. |
| 45 | * |
| 46 | * @return a custom display name; never blank or consisting solely of |
| 47 | * whitespace |
| 48 | */ |
| 49 | String value(); |
| 50 | |
| 51 | } |