Class DisplayNameGenerator.Simple

java.lang.Object
org.junit.jupiter.api.DisplayNameGenerator.Standard
org.junit.jupiter.api.DisplayNameGenerator.Simple
All Implemented Interfaces:
DisplayNameGenerator
Direct Known Subclasses:
DisplayNameGenerator.ReplaceUnderscores
Enclosing interface:
DisplayNameGenerator

public static class DisplayNameGenerator.Simple extends DisplayNameGenerator.Standard
Simple DisplayNameGenerator that removes trailing parentheses for methods with no parameters.

This generator extends the functionality of DisplayNameGenerator.Standard by removing parentheses ('()') found at the end of method names with no parameters.

  • Constructor Details

    • Simple

      public Simple()
  • Method Details

    • generateDisplayNameForMethod

      public String generateDisplayNameForMethod(List<Class<?>> enclosingInstanceTypes, Class<?> testClass, Method testMethod)
      Description copied from interface: DisplayNameGenerator
      Generate a display name for the given method.

      If this method returns null, the default display name generator will be used instead.

      Specified by:
      generateDisplayNameForMethod in interface DisplayNameGenerator
      Overrides:
      generateDisplayNameForMethod in class DisplayNameGenerator.Standard
      Parameters:
      enclosingInstanceTypes - the runtime types of the enclosing instances for the test class, ordered from outermost to innermost, excluding testClass; never null
      testClass - the class the test method is invoked on; never null
      testMethod - method to generate a display name for; never null
      Returns:
      the display name for the test; never blank