Navigation Menu

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

Added SeqTest.verifyIteratorValidity() method #310

Merged
merged 4 commits into from Jul 28, 2017

Conversation

tlinkowski
Copy link

I propose a new private method in SeqTest:

void verifyIteratorValidity(int expectedCount, Seq<T> source, Function<Seq<T>, Seq<?>> operation)

This method verifies whether our non-terminal Seq operations (e.g. limitWhile, partition, splitAt) behave as expected, i.e.:

  • whether every call to Spliterator.tryAdvance that returns true actually calls given action
  • whether the number of elements fetched from the source sequence is equal to expectedCount
  • whether calling redundantly Iterator.hasNext does not fetch any extra element from the source sequence (such calls are valid and should be "safe")

Using this method I detected two defects: #308 and #309.

@lukaseder
Copy link
Member

A late thank you very much for this suggestion. I agree with these tests, very useful.

@lukaseder lukaseder merged commit 6068ab3 into jOOQ:master Jul 28, 2017
@lukaseder
Copy link
Member

Again, I really like this utility. It will help us validate the laziness of a lot of future features... Thanks again!

@tlinkowski tlinkowski deleted the verifyIteratorValidity branch July 31, 2017 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants