Class MatcherToString

java.lang.Object
org.mockito.internal.matchers.text.MatcherToString

final class MatcherToString extends Object
Provides better toString() text for matcher that don't have toString() method declared.
  • Constructor Details

    • MatcherToString

      private MatcherToString()
  • Method Details

    • toString

      static String toString(ArgumentMatcher<?> matcher)
      Attempts to provide more descriptive toString() for given matcher. Searches matcher class hierarchy for toString() method. If it is found it will be used. If no toString() is defined for the matcher hierarchy, uses decamelized class name instead of default Object.toString(). This way we can promote meaningful names for custom matchers.
      Parameters:
      matcher -
      Returns: