Junit5: Clearly document that `name` attribute of `@ParameterizedTest` is a `MessageFormat` pattern

Created on 21 Feb 2020  路  3Comments  路  Source: junit-team/junit5


junit 5.5.2

Steps to reproduce

@ValueSource(ints = { -1, 1 })
@ParameterizedTest(name = "don't message {0}")
void myTest(int value) {}

The pling in the name string courses the test name to be formatted wrong.
The result is "dont message {0}"

Removing the pling results in:
"dont message -1" and "dont message 1"

Context

  • Used versions (Jupiter/Vintage/Platform):
  • Build Tool/IDE:
Jupiter documentation

Most helpful comment

We should document this better: name is a MessageFormat pattern, i.e. you need to write don''t message {0}.

All 3 comments

We should document this better: name is a MessageFormat pattern, i.e. you need to write don''t message {0}.

Note that we do actually have an example including single quotes in the name in the User Guide, but it's not specifically documented.

Done in c9e00df612857d55be043d4ae02026ddf5adc5b8.

Was this page helpful?
0 / 5 - 0 ratings