Size matchers to provide insightful debugging information #294
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolving my own #174.
I'm leaving the commits separate for easier reviewing, I'll squash them afterwards.
Briefly, the solution introduces a base class (I called it
SizeMatcher
) for the matchers which match on the size of a collection-like object.Although, I have to say, I'm not a huge fan of complex hierarchies (low coupling, you know), but it made perfect sense to align with the current design. Maybe that could be a separate topic to discuss, if you think it's something which could be discussed.
One thing to note is the naive algorithm I'm using to generate the correct indefinite article "a"/"an", in
SizeMatcher#indefiniteArticle
.I guess you must have already bumped into this problem, so if you already have a method to solve it more elegantly, I'll be more than happy to use it.
Please check the commit messages for more details on the changes (I had to update a few tests).
Thanks
PS: here I didn't take into account the "problem" for huge collections, which I was mentioning at the end in #174. I think we should not worry about that. The output may get cluttered, but that's the way it is, if you have a huge collection. Not our problem.