-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Cannot annotate Collections with @Datapoints, only arrays #110
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
Comments
I've come up with a solution to this, which is still pretty rough. Rather than looking at the type of a Collection, to make sure that's a Collection where T is the datatype expected by the Theory, it just cycles through EVERY Collection that is annotated with @DataPoints and selects only the elements of type T. If you have a large collection of Strings, as well as a large collection of Integers, for example, this could potentially result in serious performance issues. But it does seem to work (I also included a small unit test). Please offer suggestions of how to improve it! |
When I worked on this before, I didn't understand git very well, and it was also well before "Pull Requests 2.0" so I've redone it and cleaned up a little bit: |
@pimterry, were you doing some work on this, or is my memory completely broken? |
Yes, I was. Sorry I've got a bit delayed recently in tidying up the previous bits I started, but I'll try and get them and then this in within the next week or two :-) |
No problem, just doing some people-to-issue bookkeeping. Thanks! |
It is my understanding that this issue has been resolved by #658; it should be closed. |
Good point. Thanks, @Stephan202 ! |
SLF4J-218 removed org.apache.log4j.spi.Layout should be without "spi"
Currently, the @DataPoints annotation can only be applied to arrays, not Lists or other Collections, as described in http://stackoverflow.com/questions/2967912/junit-theories-why-cant-i-use-lists-instead-of-arrays-as-datapoints
It would be nice if you could use Lists as well, as they are often easier to work with.
The text was updated successfully, but these errors were encountered: