diff --git a/pom.xml b/pom.xml index 1bc8b349..dbe19096 100644 --- a/pom.xml +++ b/pom.xml @@ -22,8 +22,11 @@ 1.4.11 5.10.0 4.14.1 - 1.10.19 + 5.6.0 + 5.2.0 1.19.2 + 5.2.0 + 3.24.2 3.11.0 3.1.0 3.6.0 @@ -213,11 +216,33 @@ org.mockito - mockito-all + mockito-core ${version.mockito} test + + org.mockito + mockito-junit-jupiter + ${version.mockito.inline} + test + + + + org.mockito + mockito-inline + ${version.mockito.inline} + test + + + + org.assertj + assertj-core + 3.24.2 + test + + + com.cedarsoftware json-io diff --git a/src/main/java/com/cedarsoftware/util/DeepEquals.java b/src/main/java/com/cedarsoftware/util/DeepEquals.java index d9d520ee..e21d1424 100644 --- a/src/main/java/com/cedarsoftware/util/DeepEquals.java +++ b/src/main/java/com/cedarsoftware/util/DeepEquals.java @@ -5,6 +5,7 @@ import java.math.BigDecimal; import java.util.*; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicBoolean; import static com.cedarsoftware.util.Converter.convert2BigDecimal; import static com.cedarsoftware.util.Converter.convert2boolean; @@ -211,6 +212,15 @@ private static boolean deepEquals(Object a, Object b, Map options, Se continue; } + if (key1 instanceof AtomicBoolean && key2 instanceof AtomicBoolean) + { + if (!compareAtomicBoolean((AtomicBoolean)key1, (AtomicBoolean)key2)) { + return false; + } else { + continue; + } + } + if (key1 instanceof Number || key2 instanceof Number) { // If one is a Number and the other one is not, then optionally compare them as strings, otherwise return false if (allowStringsToMatchNumbers) @@ -593,7 +603,11 @@ private static boolean isContained(Object o, Collection other, Set c = Parent.class; + var fields = mock(ArrayList.class); + when(fields.add(any())).thenThrow(ThreadDeath.class); - Field f = c.getDeclaredField("foo"); - - Collection fields = mock(Collection.class); - when(fields.add(f)).thenThrow(new ThreadDeath()); - try - { - ReflectionUtils.getDeclaredFields(Parent.class, fields); - fail("should not make it here"); - } - catch (ThreadDeath ignored) - { - } + assertThatExceptionOfType(ThreadDeath.class) + .isThrownBy(() -> ReflectionUtils.getDeclaredFields(Parent.class, fields)); } @Test