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

Support cartesian product for multiple @EnumSource annotations for @ParameterizedTest #3830

Closed
cookieMr opened this issue May 24, 2024 · 2 comments

Comments

@cookieMr
Copy link

It would be nice to provide 2 (or more) @EnumSource for a single @ParameterizedTest test.
I would expect such construct to generate each possible combination of provided enum set.

@ParameterizedTest
@EnumSource(value = Status.class)
@EnumSource(value = Type.class)
void shouldDoMagic(Type type, Status status) {
    assertThat(type).isNotNull;
    assertThat(status).isNotNull;
}

What i'm going for is similar functionality as jest (typescript/jsvascript) has when dealing with nested describe.each https://jestjs.io/docs/api#describeeachtablename-fn-timeout


Right now i'm looping over both Enums (in a data provider, the @MethodAource) and creating Arguments.of() and then returning Stream.of() these Argumetns. Works.

@sormuras
Copy link
Member

https://junit-pioneer.org/docs/cartesian-product/ ?

@sormuras
Copy link
Member

Duplicates

@sbrannen sbrannen changed the title Allow Multiuple EnumSource for ParametrizedTest Support cartesian product for multiple @EnumSource annotations for @ParameterizedTest May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants