Debian Codegraph @

junit-jupiter-api/src/main/java/org/junit/jupiter/api/IndicativeSentencesGeneration.java

raw symbols SCIP
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 import org.junit.jupiter.api.DisplayNameGenerator.IndicativeSentences;
24
25 /**
26 * {@code @IndicativeSentencesGeneration} is used to register the
27 * {@link IndicativeSentences} display name generator and configure it.
28 *
29 * <p>The {@link #separator} for sentence fragments and the display name
30 * {@link #generator} for sentence fragments are configurable. If this annotation
31 * is declared without any attributes &mdash; for example,
32 * {@code @IndicativeSentencesGeneration} or {@code @IndicativeSentencesGeneration()}
33 * &mdash; the default configuration will be used.
34 *
35 * <p>This annotation is <em>inherited</em> from superclasses and implemented
36 * interfaces. It is also inherited from {@linkplain Class#getEnclosingClass()
37 * enclosing classes} for {@link Nested @Nested} test classes.
38 *
39 * @since 5.7
40 * @see DisplayName
41 * @see DisplayNameGenerator
42 * @see DisplayNameGenerator.IndicativeSentences
43 * @see DisplayNameGeneration
44 */
45 @DisplayNameGeneration(IndicativeSentences.class)
46 @Target({ ElementType.ANNOTATION_TYPE, ElementType.TYPE })
47 @Retention(RetentionPolicy.RUNTIME)
48 @Documented
49 @Inherited
50 @API(status = STABLE, since = "5.10")
51 public @interface IndicativeSentencesGeneration {
52
53 String DEFAULT_SEPARATOR = ", ";
54
55 Class<? extends DisplayNameGenerator> DEFAULT_GENERATOR = DisplayNameGenerator.Standard.class;
56
57 /**
58 * Custom separator for sentence fragments.
59 *
60 * <p>Defaults to {@value #DEFAULT_SEPARATOR}.
61 */
62 String separator() default DEFAULT_SEPARATOR;
63
64 /**
65 * Custom display name generator to use for sentence fragments.
66 *
67 * <p>Defaults to {@link DisplayNameGenerator.Standard}.
68 */
69 Class<? extends DisplayNameGenerator> generator() default DisplayNameGenerator.Standard.class;
70
71 }