Skip to content

Commit

Permalink
Untangle CartesianTestNameFormatter (#382 / #533)
Browse files Browse the repository at this point in the history
CartesianTestNameFormatter no longer references constants used by
Jupiter's ParameterizedTest.

Closes: #382
PR: #533
  • Loading branch information
Michael1993 committed Nov 14, 2021
1 parent b0e5e71 commit a7efc1c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
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 1.5
* @see #name
*/
String DISPLAY_NAME_PLACEHOLDER = "{displayName}";

/**
* Placeholder for the current invocation index of a {@code @CartesianTest}
* method (1-based): <code>{index}</code>
*
* @since 1.5
* @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 1.5
* @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

0 comments on commit a7efc1c

Please sign in to comment.