Rob Spoor wrote:You're comparing a String to a Pattern object. That's not going to work. Instead compare the String to the Pattern's pattern:
Martin Vajsar wrote:
Rob Spoor wrote:You're comparing a String to a Pattern object. That's not going to work. Instead compare the String to the Pattern's pattern:
Wouldn't assertEquals be better in this situation?
Jelle Klap wrote:Duplicate: https://coderanch.com/t/572304/Testing/JUnit-test-regex-constructor
Ivan Turner wrote:I believe I've got it. In my String, a regex pattern is stored as a String. A Pattern is not a String! To get the Pattern's variable to show it's pattern, use the pattern() method and that allows for the comparison.
Thanks again. You're wonderful!!