Duplicate regex Matcher
alb-i986 opened this issue · comments
Hi,
First of all, thanks for bringing this project back to life.
If I'm not mistaken there's a duplication in the regex matchers:
- MatchesPattern
- StringRegularExpression
There were none for such a long time and now there's two LOL
I'm not complaining huh, but I think it would be wise to leave only one ;)
Cheers
More specifically, there are two ways to match regex in test code:
- org.hamcrest.Matchers.matchesRegex(regexString)
- org.hamcrest.text.MatchesPattern.matchesPattern(regexString)
They are semantically the same, and mostly similar in implementation.
Yes the classes do appear to be duplicates and cover very similar functionaility;
org.hamcrest.Matchers.matchesRegex(String)
basically calls out to org.hamcrest.core.StringRegularExpression
org.hamcrest.core.StringRegularExpression
org.hamcrest.text.MatchesPattern
I also wonder about:
theInstance(T)
vssameInstance(T)
any(Class<T>)
vsinstanceOf(Class<T>)
Also there is a general influx of badly-considered naming, documented here.
Similarly, there's Matchers.matchesPattern(Pattern)
and Matchers.matchesRegex(Pattern)
.
This is confusing and wasting time for people trying to learn. I recommend deleting matchesRegex
👍