Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

The runner adds the square brackets to the name.

  • Loading branch information...
commit 1379441f829db2dbb048caf787e18ce6a966059b 1 parent d28f982
@stefanbirkner stefanbirkner authored
View
7 src/main/java/org/junit/runners/Parameterized.java
@@ -96,7 +96,7 @@
* etc...
* </pre>
* <p>
- * Default value is "[{index}]" for compatibility with previous JUnit
+ * Default value is "{index}" for compatibility with previous JUnit
* versions.
* </p>
*
@@ -104,7 +104,7 @@
* placeholder.
* @see MessageFormat
*/
- String name() default "[{index}]";
+ String name() default "{index}";
}
private class TestClassRunnerForParameters extends BlockJUnit4ClassRunner {
@@ -211,7 +211,8 @@ private void createRunnersForParameters(Iterable<Object[]> allParameters,
private String nameFor(String namePattern, int index, Object[] parameters) {
String finalPattern= namePattern.replaceAll("\\{index\\}",
Integer.toString(index));
- return MessageFormat.format(finalPattern, parameters);
+ String name= MessageFormat.format(finalPattern, parameters);
+ return "[" + name + "]";
}
private Exception parametersMethodReturnedWrongType() throws Exception {
View
2  src/test/java/org/junit/tests/running/classes/ParameterizedTestTest.java
@@ -25,7 +25,7 @@
public class ParameterizedTestTest {
@RunWith(Parameterized.class)
static public class FibonacciTest {
- @Parameters(name= "[{index}: fib({0})={1}]")
+ @Parameters(name= "{index}: fib({0})={1}")
public static Iterable<Object[]> data() {
return Arrays.asList(new Object[][] { { 0, 0 }, { 1, 1 }, { 2, 1 },
{ 3, 2 }, { 4, 3 }, { 5, 5 }, { 6, 8 } });
Please sign in to comment.
Something went wrong with that request. Please try again.