From a610a21e6ccd93eb31643384ad77364a9c4b1b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bence=20Er=C5=91s?= Date: Sun, 22 Dec 2019 20:59:51 +0100 Subject: [PATCH] properly fixes #340 --- .../org/everit/json/schema/regexp/JavaUtilRegexpFactory.java | 2 +- .../java/org/everit/json/schema/regexp/JavaUtilRegexpTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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(); }