Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AllBooleanCombinationsSource arguments provider #2878

Closed
tomerr90 opened this issue Apr 7, 2022 · 4 comments
Closed

AllBooleanCombinationsSource arguments provider #2878

tomerr90 opened this issue Apr 7, 2022 · 4 comments

Comments

@tomerr90
Copy link

tomerr90 commented Apr 7, 2022

A common use case we have is a test that take a bunch of boolean flags a check very slightly (mostly in expected value) based on this flag.
Classic for a ParameterizedTest, which is what we use today, but for the source we currently use CsvSource with the boolean options:

@ParameterizedTest
@CsvSource({
   "true, true",
   "true, false",
   "false, true",
   "false, false"
})
public void testMethod(boolean flag1, boolean flag2)

Which is annoying, verbose and error-prone.
So I wanted to implement an annotation like @AllBooleanCombinationsSource(int) that takes the number of boolean params and generate all possible combinations.
Though this might be a bit too specific, so wanted to get your opinion, is that something that you think belongs in Junit?

@sbrannen
Copy link
Member

sbrannen commented Apr 7, 2022

Take a look at the Cartesian product support in JUnit Pioneer.

I think that might suit your needs.

@tomerr90
Copy link
Author

tomerr90 commented Apr 7, 2022

Thanks @sbrannen! yeah Im aware of that, we didnt want to add a dependency just for one annotation

@XIANY1203
Copy link

May I try?

@marcphilipp
Copy link
Member

Team Decision: We advise to use the feature from Pioneer and won't include this in Jupiter core for the time being.

@marcphilipp marcphilipp closed this as not planned Won't fix, can't repro, duplicate, stale Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants