Primitive array subject `Iterable` views' methods are misnamed
See original GitHub issueWe have:
containsAtLeastcontainsAnyOfcontainsExactlycontainsNoneOf
But the methods accept arrays, so they should use the names we use for Iterable- and array-accepting methods elsewhere:
containsAtLeastElementsIncontainsAnyIncontainsExactlyElementsIncontainsNoneIn
(To be clear, I’m talking about the methods in PrimitiveDoubleArraySubject.DoubleArrayAsIterable and PrimitiveFloatArraySubject.FloatArrayAsIterable.)
I didn’t see explicit discussion of the names in the doc “Truth about arrays (esp. double[]),” and in fact the doc suggests that we didn’t yet have a precedent for array-accepting methods, as it links to bug 18153623, the bug about IterableSubject.containsExactlyElementsIn(Object[]), etc. Or really, we did have a precedent, and that was to tell people to call the varargs methods, like containsExactly. So we followed precedent fine; we just didn’t realize that we had to update these methods when we added the methods to IterableSubject.
All that said, I can’t imagine that I’ll get around to fixing this, and I can live with that. Still, @kluever and @PeteGillin in case they want to argue that this is worse than I think. And I’m adding it to the 1.0 milestone to make sure I drop it consciously when the time comes.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)

Top Related StackOverflow Question
Since I don’t expect us to make breaking changes, I want to be careful about the message I’d send by having such a list. That said… I do have one 😃 – but more with the idea that it could make some interesting blog posts for people interested in API Design or writing Truth for MyLanguage. I’m not sure anything will ever come of that, but we’ll see.
@cpovirk ^