| 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.Inherited; |
| 18 | import java.lang.annotation.Retention; |
| 19 | import java.lang.annotation.RetentionPolicy; |
| 20 | import java.lang.annotation.Target; |
| 21 | |
| 22 | import org.apiguardian.api.API; |
| 23 | |
| 24 | /** |
| 25 | * {@code @DisplayNameGeneration} is used to declare a custom display name |
| 26 | * generator for the annotated test class. |
| 27 | * |
| 28 | * <p>This annotation is <em>inherited</em> from superclasses and implemented |
| 29 | * interfaces. It is also inherited from {@linkplain Class#getEnclosingClass() |
| 30 | * enclosing classes} for {@link Nested @Nested} test classes. |
| 31 | * |
| 32 | * <p>As an alternative to {@code @DisplayNameGeneration}, a global |
| 33 | * {@link DisplayNameGenerator} can be configured for the entire test suite via |
| 34 | * the {@value DisplayNameGenerator#DEFAULT_GENERATOR_PROPERTY_NAME} configuration parameter. See |
| 35 | * the User Guide for details. Note, however, that a {@code @DisplayNameGeneration} |
| 36 | * declaration always overrides a global {@code DisplayNameGenerator}. |
| 37 | * |
| 38 | * @since 5.4 |
| 39 | * @see DisplayName |
| 40 | * @see DisplayNameGenerator |
| 41 | * @see IndicativeSentencesGeneration |
| 42 | */ |
| 43 | @Target(ElementType.TYPE) |
| 44 | @Retention(RetentionPolicy.RUNTIME) |
| 45 | @Documented |
| 46 | @Inherited |
| 47 | @API(status = STABLE, since = "5.7") |
| 48 | public @interface DisplayNameGeneration { |
| 49 | |
| 50 | /** |
| 51 | * Custom display name generator. |
| 52 | * |
| 53 | * @return custom display name generator class |
| 54 | */ |
| 55 | Class<? extends DisplayNameGenerator> value(); |
| 56 | |
| 57 | } |