Skip to content

Generate a single parameter if type is JsonArray when using @JsonFileSource #53

@mxandeco

Description

@mxandeco

When using @JsonFileSource if the file contains an array of object the argument provider will always generate a stream with individual json objects and the test will be executed once per element, that's is fine and useful, but a common is to have the actual json array, e.g.

@ParameterizedTest
@JsonFileSource(resources = "/array-of-objects.json")
void jsonArray(JsonArray jsonArray  ) {
}

In the base above, I would like to have access to the full json object and not to each item in multiple iterations, another example would be:

@ParameterizedTest
@JsonFileSource(resources = "/array-of-objects.json")
void jsonArray(List<JsonObject> jsonArray  ) {
}

Where then I would like a list with all the json elements at once instead of one element per test execution.

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