Class DisplayNameGenerator.IndicativeSentences
- java.lang.Object
-
- org.junit.jupiter.api.DisplayNameGenerator.IndicativeSentences
-
- All Implemented Interfaces:
DisplayNameGenerator
- Enclosing interface:
- DisplayNameGenerator
@API(status=STABLE, since="5.10") public static class DisplayNameGenerator.IndicativeSentences extends java.lang.Object implements DisplayNameGeneratorDisplayNameGeneratorthat generates complete sentences.This generator generates display names that build up complete sentences by concatenating the names of the test and the enclosing classes. The sentence fragments are concatenated using a separator. The separator and the display name generator for individual sentence fragments can be configured via the
@IndicativeSentencesGenerationannotation.If you do not want to rely on a display name generator for individual sentence fragments, you can supply custom text for individual fragments via the
@SentenceFragmentannotation.- Since:
- 5.7
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceDisplayNameGenerator.IndicativeSentences.SentenceFragment@SentenceFragmentis used to configure a custom sentence fragment for a sentence generated by theIndicativeSentencesDisplayNameGenerator.-
Nested classes/interfaces inherited from interface org.junit.jupiter.api.DisplayNameGenerator
DisplayNameGenerator.IndicativeSentences, DisplayNameGenerator.ReplaceUnderscores, DisplayNameGenerator.Simple, DisplayNameGenerator.Standard
-
-
Field Summary
-
Fields inherited from interface org.junit.jupiter.api.DisplayNameGenerator
DEFAULT_GENERATOR_PROPERTY_NAME
-
-
Constructor Summary
Constructors Constructor Description IndicativeSentences()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgenerateDisplayNameForClass(java.lang.Class<?> testClass)Generate a display name for the given top-level orstaticnested test class.java.lang.StringgenerateDisplayNameForMethod(java.util.List<java.lang.Class<?>> enclosingInstanceTypes, java.lang.Class<?> testClass, java.lang.reflect.Method testMethod)Generate a display name for the given method.java.lang.StringgenerateDisplayNameForNestedClass(java.util.List<java.lang.Class<?>> enclosingInstanceTypes, java.lang.Class<?> nestedClass)Generate a display name for the given@Nestedinner test class.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.junit.jupiter.api.DisplayNameGenerator
generateDisplayNameForMethod, generateDisplayNameForNestedClass
-
-
-
-
Method Detail
-
generateDisplayNameForClass
public java.lang.String generateDisplayNameForClass(java.lang.Class<?> testClass)
Description copied from interface:DisplayNameGeneratorGenerate a display name for the given top-level orstaticnested test class.If this method returns
null, the default display name generator will be used instead.- Specified by:
generateDisplayNameForClassin interfaceDisplayNameGenerator- Parameters:
testClass- the class to generate a name for; nevernull- Returns:
- the display name for the class; never blank
-
generateDisplayNameForNestedClass
public java.lang.String generateDisplayNameForNestedClass(java.util.List<java.lang.Class<?>> enclosingInstanceTypes, java.lang.Class<?> nestedClass)Description copied from interface:DisplayNameGeneratorGenerate a display name for the given@Nestedinner test class.If this method returns
null, the default display name generator will be used instead.- Specified by:
generateDisplayNameForNestedClassin interfaceDisplayNameGenerator- Parameters:
enclosingInstanceTypes- the runtime types of the enclosing instances for the test class, ordered from outermost to innermost, excludingnestedClass; nevernullnestedClass- the class to generate a name for; nevernull- Returns:
- the display name for the nested class; never blank
-
generateDisplayNameForMethod
public java.lang.String generateDisplayNameForMethod(java.util.List<java.lang.Class<?>> enclosingInstanceTypes, java.lang.Class<?> testClass, java.lang.reflect.Method testMethod)Description copied from interface:DisplayNameGeneratorGenerate a display name for the given method.If this method returns
null, the default display name generator will be used instead.- Specified by:
generateDisplayNameForMethodin interfaceDisplayNameGenerator- Parameters:
enclosingInstanceTypes- the runtime types of the enclosing instances for the test class, ordered from outermost to innermost, excludingtestClass; nevernulltestClass- the class the test method is invoked on; nevernulltestMethod- method to generate a display name for; nevernull- Returns:
- the display name for the test; never blank
-
-