Skip to content

Parameterized test methods don't display name properly when given escape sequences #1167

@aporo69

Description

@aporo69

Hello everyone,

We had a little issue at work today using a parameterized test runner which was given characters as arguments which happened to be escape sequences.

The issue happens when using a name attribute in the @parameter annotation. For example:

@Parameter(name = "This won't display properly when given some special characters: {0}")
public static Collection<Character[]> parameters() {
    return Arrays.asList(new Character[][]{
        { '\0' }
    });
}

The test does not fail but it creates issues through the rest of our tool chain.

We are using JUnit 4.11 but the issue exists in JUnit 4.12 too. I happened to make a small Maven project to illustrate the problem and I also made a patch for JUnit 4.11 and 4.12. Feel free to use everything.

Thank you for all your hard work.

Both Maven project and patches can be found there: https://github.com/aporo69/junit-issue-1167.git

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions