aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-03-26 17:29:44 +0000
committerMichael Williamson <mike@zwobble.org>2016-03-26 17:29:44 +0000
commit8a2ae936c954bca7662a421cc0b2489296cb2c92 (patch)
treee706c5144c1c228f104b2cf61f4df03ea35ba00f /src
parentd25ec1e590806b6639583206a3bc9202f07b61ee (diff)
Remove Guava usage from DeepReflectionMatcher
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/zwobble/mammoth/internal/util/MammothSets.java6
-rw-r--r--src/test/java/org/zwobble/mammoth/tests/DeepReflectionMatcher.java4
2 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/org/zwobble/mammoth/internal/util/MammothSets.java b/src/main/java/org/zwobble/mammoth/internal/util/MammothSets.java
index 87f7bbe..4f06efc 100644
--- a/src/main/java/org/zwobble/mammoth/internal/util/MammothSets.java
+++ b/src/main/java/org/zwobble/mammoth/internal/util/MammothSets.java
@@ -24,6 +24,12 @@ public class MammothSets {
return set;
}
+ public static <T> Set<T> difference(Set<? extends T> set1, Set<? extends T> set2) {
+ HashSet<T> result = new HashSet<>(set1);
+ result.removeAll(set2);
+ return result;
+ }
+
public static <T> Set<T> toSet(Iterable<T> iterable) {
return stream(iterable).collect(Collectors.toSet());
}
diff --git a/src/test/java/org/zwobble/mammoth/tests/DeepReflectionMatcher.java b/src/test/java/org/zwobble/mammoth/tests/DeepReflectionMatcher.java
index 5f26b42..35175d6 100644
--- a/src/test/java/org/zwobble/mammoth/tests/DeepReflectionMatcher.java
+++ b/src/test/java/org/zwobble/mammoth/tests/DeepReflectionMatcher.java
@@ -1,10 +1,10 @@
package org.zwobble.mammoth.tests;
-import com.google.common.collect.Sets;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.hamcrest.TypeSafeDiagnosingMatcher;
+import org.zwobble.mammoth.internal.util.MammothSets;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
@@ -143,7 +143,7 @@ public class DeepReflectionMatcher<T> extends TypeSafeDiagnosingMatcher<T> {
}
private static boolean handleExtraElements(String path, Map<?, ?> expected, Map<?, ?> actual, Description mismatchDescription, String prefix) {
- Sets.SetView<?> extraElements = Sets.difference(actual.keySet(), expected.keySet());
+ Set<?> extraElements = MammothSets.difference(actual.keySet(), expected.keySet());
if (!extraElements.isEmpty()) {
appendPath(mismatchDescription, path);
mismatchDescription.appendText(prefix +