Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Untangle CartesianTestNameFormatter from ParameterizedTest #533

Merged
merged 3 commits into from
Nov 14, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
* <a href="https://junit-pioneer.org/docs/cartesian-product/" target="_top">the documentation on <code>@CartesianTest</code></a>.
* </p>
*
* @see org.junitpioneer.jupiter.CartesianValueSource
* @since 1.5.0
*/
@TestTemplate
Expand All @@ -58,6 +57,33 @@
@Retention(RetentionPolicy.RUNTIME)
public @interface CartesianTest {

/**
* Placeholder for the display name of a {@code @CartesianTest}
*
* @since 5.3
* @see #name
*/
String DISPLAY_NAME_PLACEHOLDER = "{displayName}";

/**
* Placeholder for the current invocation index of a {@code @CartesianTest}
* method (1-based): <code>{index}</code>
*
* @since 5.3
* @see #name
*/
String INDEX_PLACEHOLDER = "{index}";

/**
* Placeholder for the complete, comma-separated arguments list of the
* current invocation of a {@code @CartesianTest} method:
* <code>{arguments}</code>
*
* @since 5.3
* @see #name
*/
String ARGUMENTS_PLACEHOLDER = "{arguments}";

/**
* <p>The display name to be used for individual invocations of the
* parameterized test; never blank or consisting solely of whitespace.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
package org.junitpioneer.jupiter.cartesian;

import static java.util.stream.Collectors.joining;
import static org.junit.jupiter.params.ParameterizedTest.ARGUMENTS_PLACEHOLDER;
import static org.junit.jupiter.params.ParameterizedTest.DISPLAY_NAME_PLACEHOLDER;
import static org.junit.jupiter.params.ParameterizedTest.INDEX_PLACEHOLDER;
import static org.junitpioneer.jupiter.cartesian.CartesianTest.ARGUMENTS_PLACEHOLDER;
import static org.junitpioneer.jupiter.cartesian.CartesianTest.DISPLAY_NAME_PLACEHOLDER;
import static org.junitpioneer.jupiter.cartesian.CartesianTest.INDEX_PLACEHOLDER;

import java.text.MessageFormat;
import java.util.Arrays;
Expand Down