You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, has().*() used to be on iterable, but I wanted to distinguish random access types from iterables, since iterables have a very limited contract, and must behave a certain way. But the more I think of it, the more I think Iterable() should have these, and IteratorSubject should exist which allows you to do the things I currently am thinking of for Iterable. I'm not sure why I didn't think of that before. It's really iterator behaviour I wanted to keep clear from collection/list/etc, since isOrdered()/containsSequence() are list/bag/set operations, but Iterator is a walk over elements. So... I think I might just do that.
I'm a little worried about copying iterables into a list (even though it's a test) as some tests need to test statefully through the test, so exploding the whole iterator's contents can mess that up. That said, if I pull out the iterator itself, so those sorts of tests can go ASSERT.that(iterable.iterator()).blahblahblah(), then that is the escape valve for those kinds of tests.
Hi.
Wondering if assertions on Collection and List can be applied to all Iterable's.
Most assertions from ListSubject and CollectionSubject seem to also make sense to iterables:
isEmpty()
isOrdered()
containsSequence()
has().exactly(...)
So how about flattening the class hierarchy and just have all these assertions for any Iterable?
Internally some implementations could simply copy the Iterable into a List. It's a test after all.
I believe it also makes the API surface smaller.
The text was updated successfully, but these errors were encountered: