Skip to content

@Elements converter for collection-like string representations #30

@scordio

Description

@scordio

A new @Elements composed annotation could be added to convert collection-like strings to JDK types, e.g., arrays, List, Iterable, Collection, Set, Map, etc. Their Sequenced variants should also be supported.

The underlying JUnit conversion capabilities could serve as a delegate for converting each element.

The converter should support common string representations, like:

Array / List / Collection / Iterable

  • JSON-style: [1, 2, 3]
  • CSV-style like 1, 2, 3 (would likely not work when used in combination with @CsvSource, but maybe that use case could be supported with a configurable delimiter, e.g., 1; 2; 3 , 1|2|3)

Set

  • Curly braces: {1, 2, 3}
  • Square brackets: [1, 2, 3]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions