diff --git a/core/src/main/java/org/everit/json/schema/regexp/JavaUtilRegexpFactory.java b/core/src/main/java/org/everit/json/schema/regexp/JavaUtilRegexpFactory.java index 25a41d8ca..538c94214 100644 --- a/core/src/main/java/org/everit/json/schema/regexp/JavaUtilRegexpFactory.java +++ b/core/src/main/java/org/everit/json/schema/regexp/JavaUtilRegexpFactory.java @@ -27,7 +27,7 @@ class JavaUtilRegexp extends AbstractRegexp { if (!(o instanceof JavaUtilRegexp)) return false; JavaUtilRegexp that = (JavaUtilRegexp) o; - return Objects.equals(pattern, that.pattern); + return Objects.equals(pattern.pattern(), that.pattern.pattern()); } @Override public int hashCode() { diff --git a/core/src/test/java/org/everit/json/schema/regexp/JavaUtilRegexpTest.java b/core/src/test/java/org/everit/json/schema/regexp/JavaUtilRegexpTest.java index 33e974320..da085a4d3 100644 --- a/core/src/test/java/org/everit/json/schema/regexp/JavaUtilRegexpTest.java +++ b/core/src/test/java/org/everit/json/schema/regexp/JavaUtilRegexpTest.java @@ -39,7 +39,7 @@ public void asString() { public void equalsVerifier() { EqualsVerifier.forClass(JavaUtilRegexp.class) .withPrefabValues(Pattern.class, Pattern.compile("red"), Pattern.compile("black")) - .withIgnoredFields("asString") + .withIgnoredFields("asString").withNonnullFields("pattern") .suppress(Warning.STRICT_INHERITANCE) .verify(); }