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

Allow Dataproviders to return List<List<Object>> #1929

Open
lbergelson opened this issue Oct 5, 2018 · 3 comments
Open

Allow Dataproviders to return List<List<Object>> #1929

lbergelson opened this issue Oct 5, 2018 · 3 comments

Comments

@lbergelson
Copy link

Arrays can be inconvenient to work with. It would be nice if DataProviders could return a larger variety of types.

Particularly, I'd like to be able to use List<List<Object> as the return type, but something more general like Iterable<? extends Iterable<?>> might be better.

@sskorol
Copy link
Contributor

sskorol commented Oct 5, 2018

@lbergelson you can try https://github.com/sskorol/test-data-supplier - DataProvider on steroids. It has Java 8, 10 and 11 support, and allows returning any type you want.

@lbergelson
Copy link
Author

Oh, that looks very interesting. I will check it out.

@Skenvy
Copy link

Skenvy commented Apr 21, 2019

I've found it's possible to knock out arbitrary Iterable<? extends Iterable<?>> by setting a configurable object's (of the test class) variable through @Factory wherein the object.variable is set to an instance of <? extends Iterable<?>>, and the object.variable gets passed to an @DataProvider which unwraps the iterator Iterable<?> onto the @DataProvider's array, a la [i][0] = <?>

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

4 participants