Allows developers to easily use JSON files as sources for their parameterized tests #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed Change
Provides a way to supply arguments to parameterized tests in JUnit 5 by reading JSON files specified by the {@link JsonFileSource} annotation.
The {@code JsonFileArgumentsProvider} is responsible for locating the JSON files specified in the annotation, reading their contents, and converting them into objects of the type expected by the test method parameters. It supports both simple and generic types, including handling of recursive type references by setting them to {@code null} to prevent infinite loops during JSON parsing.
Type Of Change
What type of change does this PR introduce?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further Comments
As a backend engineer at Alibaba Group, I've found JUnit 5 to be an excellent testing framework that provides a lot of flexibility and power. However, I noticed that it lacks built-in support for JSON sources in parameterized tests, which is a feature that could significantly enhance the testing of JSON-dependent applications.
To address this, I propose the addition of the
JsonFileSource
annotation, accompanied by theJsonFileArgumentsProvider
class. This feature allows developers to easily use JSON files as sources for their parameterized tests, enabling more comprehensive and data-driven testing scenarios.