Top Inners Fields Constructors Methods
org.junit.jupiter.params

pack-priv Class ParameterizedInvocationNameFormatter

extends Object
Class Inheritance
Static Imports
java.util.Objects.requireNonNull, org.junit.jupiter.params.ParameterizedInvocationConstants.ARGUMENTS_PLACEHOLDER, .ParameterizedInvocationConstants.ARGUMENTS_WITH_NAMES_PLACEHOLDER, .ParameterizedInvocationConstants.ARGUMENT_SET_NAME_OR_ARGUMENTS_WITH_NAMES_PLACEHOLDER, .ParameterizedInvocationConstants.ARGUMENT_SET_NAME_PLACEHOLDER, .ParameterizedInvocationConstants.DISPLAY_NAME_PLACEHOLDER, .ParameterizedInvocationConstants.INDEX_PLACEHOLDER, org.junit.platform.commons.util.StringUtils.isNotBlank

Since
5.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static record
private static record
private static class
ParameterizedInvocationNameFormatter.CachingByArgumentsLengthPartialFormatter

Caches formatters by the length of the consumed arguments which may differ from the number of declared parameters.

private static class
private static interface
private static class
private static record

Field Summary

Modifier and TypeField and Description
pack-priv static final String
private static final Map<Integer, String>
argumentsPatternCache

Global cache for {arguments} pattern strings, keyed by the number of arguments.

pack-priv static final String
pack-priv static final String
pack-priv static final String
private final ParameterizedInvocationNameFormatter.PartialFormatter[]

Constructor Summary

AccessConstructor and Description
pack-priv
ParameterizedInvocationNameFormatter(String pattern, String displayName, ParameterizedDeclarationContext<?> declarationContext, int argumentMaxLength)

Method Summary

Modifier and TypeMethod and Description
private static String
argumentsPattern(int length)

pack-priv static ParameterizedInvocationNameFormatter
create(ExtensionContext extensionContext, ParameterizedDeclarationContext<?> declarationContext)

private ParameterizedInvocationNameFormatter.PartialFormatters
createPartialFormatters(String displayName, ParameterizedDeclarationContext<?> declarationContext, int argumentMaxLength)

private static ParameterizedInvocationNameFormatter.PartialFormatter
determineNonPlaceholderFormatter(String segment, int argumentMaxLength)

private static @Nullable ParameterizedInvocationNameFormatter.PlaceholderPosition
pack-priv String
format(int invocationIndex, EvaluatedArgumentSet arguments, boolean quoteTextArguments)

private String
formatSafely(int invocationIndex, EvaluatedArgumentSet arguments, boolean quoteTextArguments)

private ParameterizedInvocationNameFormatter.PartialFormatter[]
parse(String pattern, String displayName, ParameterizedDeclarationContext<?> declarationContext, int argumentMaxLength)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ARGUMENT_MAX_LENGTH_KEYback to summary
pack-priv static final String ARGUMENT_MAX_LENGTH_KEY
argumentsPatternCacheback to summary
private static final Map<Integer, String> argumentsPatternCache

Global cache for {arguments} pattern strings, keyed by the number of arguments.

Since
6.0
DEFAULT_DISPLAY_NAMEback to summary
pack-priv static final String DEFAULT_DISPLAY_NAME
DEFAULT_DISPLAY_NAME_PATTERNback to summary
pack-priv static final String DEFAULT_DISPLAY_NAME_PATTERN
DISPLAY_NAME_PATTERN_KEYback to summary
pack-priv static final String DISPLAY_NAME_PATTERN_KEY
partialFormattersback to summary
private final ParameterizedInvocationNameFormatter.PartialFormatter[] partialFormatters

Constructor Detail

ParameterizedInvocationNameFormatterback to summary
pack-priv ParameterizedInvocationNameFormatter(String pattern, String displayName, ParameterizedDeclarationContext<?> declarationContext, int argumentMaxLength)

Method Detail

argumentsPatternback to summary
private static String argumentsPattern(int length)
createback to summary
pack-priv static ParameterizedInvocationNameFormatter create(ExtensionContext extensionContext, ParameterizedDeclarationContext<?> declarationContext)
createPartialFormattersback to summary
private ParameterizedInvocationNameFormatter.PartialFormatters createPartialFormatters(String displayName, ParameterizedDeclarationContext<?> declarationContext, int argumentMaxLength)
determineNonPlaceholderFormatterback to summary
private static ParameterizedInvocationNameFormatter.PartialFormatter determineNonPlaceholderFormatter(String segment, int argumentMaxLength)
findFirstPlaceholderback to summary
private static @Nullable ParameterizedInvocationNameFormatter.PlaceholderPosition findFirstPlaceholder(ParameterizedInvocationNameFormatter.PartialFormatters formatters, String segment)
formatback to summary
pack-priv String format(int invocationIndex, EvaluatedArgumentSet arguments, boolean quoteTextArguments)
formatSafelyback to summary
private String formatSafely(int invocationIndex, EvaluatedArgumentSet arguments, boolean quoteTextArguments)
Annotations
@SuppressWarnings:JdkObsolete
parseback to summary
private ParameterizedInvocationNameFormatter.PartialFormatter[] parse(String pattern, String displayName, ParameterizedDeclarationContext<?> declarationContext, int argumentMaxLength)
org.junit.jupiter.params back to summary

private final Record ParameterizedInvocationNameFormatter.ArgumentsContext

extends Record
Class Inheritance
Annotations
@SuppressWarnings:ArrayRecordComponent
Record Components
invocationIndex:int 
consumedArguments:@Nullable Object[] 
argumentSetName:Optional<String> 
quoteTextArguments:boolean 

Field Summary

Modifier and TypeField and Description
private final Optional<String>
argumentSetName

Record Component accessed by argumentSetName().

private final @Nullable Object[]
consumedArguments

Record Component accessed by consumedArguments().

private final int
invocationIndex

Record Component accessed by invocationIndex().

private final boolean
quoteTextArguments

Record Component accessed by quoteTextArguments().

Constructor Summary

AccessConstructor and Description
private
ArgumentsContext(int invocationIndex, @Nullable Object[] consumedArguments, Optional<String> argumentSetName, boolean quoteTextArguments)

Method Summary

Modifier and TypeMethod and Description
public Optional<String>
argumentSetName()

Record Component getter of argumentSetName.

public @Nullable Object[]
consumedArguments()

Record Component getter of consumedArguments.

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public int
invocationIndex()

Record Component getter of invocationIndex.

public boolean
quoteTextArguments()

Record Component getter of quoteTextArguments.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

argumentSetNameback to summary
private final Optional<String> argumentSetName

Record Component accessed by argumentSetName().

consumedArgumentsback to summary
private final @Nullable Object[] consumedArguments

Record Component accessed by consumedArguments().

invocationIndexback to summary
private final int invocationIndex

Record Component accessed by invocationIndex().

quoteTextArgumentsback to summary
private final boolean quoteTextArguments

Record Component accessed by quoteTextArguments().

Constructor Detail

ArgumentsContextback to summary
private ArgumentsContext(int invocationIndex, @Nullable Object[] consumedArguments, Optional<String> argumentSetName, boolean quoteTextArguments)

Method Detail

argumentSetNameback to summary
public Optional<String> argumentSetName()

Record Component getter of argumentSetName.

consumedArgumentsback to summary
public @Nullable Object[] consumedArguments()

Record Component getter of consumedArguments.

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

invocationIndexback to summary
public int invocationIndex()

Record Component getter of invocationIndex.

quoteTextArgumentsback to summary
public boolean quoteTextArguments()

Record Component getter of quoteTextArguments.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

org.junit.jupiter.params back to summary

private final Record ParameterizedInvocationNameFormatter.ArgumentSetNameFormatter

extends Record
implements PartialFormatter
Class Inheritance
All Implemented Interfaces
org.junit.jupiter.params.ParameterizedInvocationNameFormatter.PartialFormatter
Record Components
annotationName:String 

Field Summary

Modifier and TypeField and Description
private final String
annotationName

Record Component accessed by annotationName().

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public String
annotationName()

Record Component getter of annotationName.

public void
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

annotationNameback to summary
private final String annotationName

Record Component accessed by annotationName().

Constructor Detail

ArgumentSetNameFormatterback to summary
private ArgumentSetNameFormatter(String annotationName)

Method Detail

annotationNameback to summary
public String annotationName()

Record Component getter of annotationName.

appendback to summary
public void append(ParameterizedInvocationNameFormatter.ArgumentsContext context, StringBuffer result)

Implements org.junit.jupiter.params.ParameterizedInvocationNameFormatter.PartialFormatter.append.

Annotations
@Override
equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

org.junit.jupiter.params back to summary

private Class ParameterizedInvocationNameFormatter.CachingByArgumentsLengthPartialFormatter

extends Object
implements PartialFormatter
Class Inheritance
  • java.lang.Object
  • org.junit.jupiter.params.ParameterizedInvocationNameFormatter.CachingByArgumentsLengthPartialFormatter
All Implemented Interfaces
org.junit.jupiter.params.ParameterizedInvocationNameFormatter.PartialFormatter

Caches formatters by the length of the consumed arguments which may differ from the number of declared parameters.

For example, when using multiple providers or a provider that returns argument arrays of different length, such as:

@ParameterizedTest
@CsvSource({"a", "a,b", "a,b,c"})
void test(ArgumentsAccessor accessor) {}

Field Summary

Modifier and TypeField and Description
private final ConcurrentMap<Integer, ParameterizedInvocationNameFormatter.PartialFormatter>
private final Function<Integer, ParameterizedInvocationNameFormatter.PartialFormatter>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheback to summary
private final ConcurrentMap<Integer, ParameterizedInvocationNameFormatter.PartialFormatter> cache
factoryback to summary
private final Function<Integer, ParameterizedInvocationNameFormatter.PartialFormatter> factory

Constructor Detail

CachingByArgumentsLengthPartialFormatterback to summary
pack-priv CachingByArgumentsLengthPartialFormatter(Function<Integer, ParameterizedInvocationNameFormatter.PartialFormatter> factory)

Method Detail

appendback to summary
public void append(ParameterizedInvocationNameFormatter.ArgumentsContext context, StringBuffer result)

Implements org.junit.jupiter.params.ParameterizedInvocationNameFormatter.PartialFormatter.append.

Annotations
@Override
org.junit.jupiter.params back to summary

private Class ParameterizedInvocationNameFormatter.MessageFormatPartialFormatter

extends Object
implements PartialFormatter
Class Inheritance
  • java.lang.Object
  • org.junit.jupiter.params.ParameterizedInvocationNameFormatter.MessageFormatPartialFormatter
All Implemented Interfaces
org.junit.jupiter.params.ParameterizedInvocationNameFormatter.PartialFormatter

Field Summary

Modifier and TypeField and Description
private final int
private static final char
private final boolean
private final MessageFormat
private final @Nullable ResolverFacade

Constructor Summary

AccessConstructor and Description
pack-priv
MessageFormatPartialFormatter(String pattern, int argumentMaxLength)

pack-priv
MessageFormatPartialFormatter(String pattern, int argumentMaxLength, boolean generateNameValuePairs, @Nullable ResolverFacade resolverFacade)

Method Summary

Modifier and TypeMethod and Description
public synchronized void
private @Nullable Object[]
makeReadable(@Nullable Object[] arguments, boolean quoteTextArguments)

private String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

argumentMaxLengthback to summary
private final int argumentMaxLength
ELLIPSISback to summary
private static final char ELLIPSIS
Annotations
@SuppressWarnings:UnnecessaryUnicodeEscape
generateNameValuePairsback to summary
private final boolean generateNameValuePairs
messageFormatback to summary
private final MessageFormat messageFormat
resolverFacadeback to summary
private final @Nullable ResolverFacade resolverFacade

Constructor Detail

MessageFormatPartialFormatterback to summary
pack-priv MessageFormatPartialFormatter(String pattern, int argumentMaxLength)
MessageFormatPartialFormatterback to summary
pack-priv MessageFormatPartialFormatter(String pattern, int argumentMaxLength, boolean generateNameValuePairs, @Nullable ResolverFacade resolverFacade)

Method Detail

appendback to summary
public synchronized void append(ParameterizedInvocationNameFormatter.ArgumentsContext context, StringBuffer result)

Implements org.junit.jupiter.params.ParameterizedInvocationNameFormatter.PartialFormatter.append.

Annotations
@Override
makeReadableback to summary
private @Nullable Object[] makeReadable(@Nullable Object[] arguments, boolean quoteTextArguments)
truncateIfExceedsMaxLengthback to summary
private String truncateIfExceedsMaxLength(String argument)
org.junit.jupiter.params back to summary

private Interface ParameterizedInvocationNameFormatter.PartialFormatter

Known Direct Implementers
org.junit.jupiter.params.ParameterizedInvocationNameFormatter.ArgumentSetNameFormatter, org.junit.jupiter.params.ParameterizedInvocationNameFormatter.MessageFormatPartialFormatter, org.junit.jupiter.params.ParameterizedInvocationNameFormatter.CachingByArgumentsLengthPartialFormatter
Annotations
@FunctionalInterface

Field Summary

Modifier and TypeField and Description
public static final ParameterizedInvocationNameFormatter.PartialFormatter

Method Summary

Modifier and TypeMethod and Description
public void

Field Detail

INDEXback to summary
public static final ParameterizedInvocationNameFormatter.PartialFormatter INDEX

Method Detail

appendback to summary
public void append(ParameterizedInvocationNameFormatter.ArgumentsContext context, StringBuffer result)
org.junit.jupiter.params back to summary

private Class ParameterizedInvocationNameFormatter.PartialFormatters

extends Object
Class Inheritance
  • java.lang.Object
  • org.junit.jupiter.params.ParameterizedInvocationNameFormatter.PartialFormatters

Field Summary

Modifier and TypeField and Description
private final Map<String, ParameterizedInvocationNameFormatter.PartialFormatter>
private int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv ParameterizedInvocationNameFormatter.PartialFormatter
get(String placeholder)

pack-priv Set<String>
pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

formattersByPlaceholderback to summary
private final Map<String, ParameterizedInvocationNameFormatter.PartialFormatter> formattersByPlaceholder
minimumPlaceholderLengthback to summary
private int minimumPlaceholderLength

Constructor Detail

PartialFormattersback to summary
private PartialFormatters()

Method Detail

getback to summary
pack-priv ParameterizedInvocationNameFormatter.PartialFormatter get(String placeholder)
placeholdersback to summary
pack-priv Set<String> placeholders()
putback to summary
pack-priv void put(String placeholder, ParameterizedInvocationNameFormatter.PartialFormatter formatter)
org.junit.jupiter.params back to summary

private final Record ParameterizedInvocationNameFormatter.PlaceholderPosition

extends Record
Class Inheritance
Record Components
index:int 
placeholder:String 

Field Summary

Modifier and TypeField and Description
private final int
index

Record Component accessed by index().

private final String
placeholder

Record Component accessed by placeholder().

Constructor Summary

AccessConstructor and Description
private
PlaceholderPosition(int index, String placeholder)

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public int
index()

Record Component getter of index.

public String
placeholder()

Record Component getter of placeholder.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

indexback to summary
private final int index

Record Component accessed by index().

placeholderback to summary
private final String placeholder

Record Component accessed by placeholder().

Constructor Detail

PlaceholderPositionback to summary
private PlaceholderPosition(int index, String placeholder)

Method Detail

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

indexback to summary
public int index()

Record Component getter of index.

placeholderback to summary
public String placeholder()

Record Component getter of placeholder.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.