Permalink
Browse files

The runner adds the square brackets to the name.

  • Loading branch information...
1 parent d28f982 commit 1379441f829db2dbb048caf787e18ce6a966059b @stefanbirkner stefanbirkner committed Mar 5, 2012
@@ -96,15 +96,15 @@
* etc...
* </pre>
* <p>
- * Default value is "[{index}]" for compatibility with previous JUnit
+ * Default value is "{index}" for compatibility with previous JUnit
* versions.
* </p>
*
* @return {@link MessageFormat} pattern string, except the index
* 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 {
@@ -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 } });

0 comments on commit 1379441

Please sign in to comment.