summaryrefslogtreecommitdiff
path: root/src/test/java/org
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-03-26 09:51:39 +0000
committerMichael Williamson <mike@zwobble.org>2016-03-26 09:51:39 +0000
commit70e00d6d98136e00fd8c8482f89427b7e602c723 (patch)
treeff91f6800977c946c1502ffeb29cc2e210e24d44 /src/test/java/org
parent08af6720105bbb3cf2061e98727ba5ca67da3144 (diff)
Remove usages of Iterables.filter
Diffstat (limited to 'src/test/java/org')
-rw-r--r--src/test/java/org/zwobble/mammoth/tests/DeepReflectionMatcher.java22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/DeepReflectionMatcher.java b/src/test/java/org/zwobble/mammoth/tests/DeepReflectionMatcher.java
index dff85a8..19a8043 100644
--- a/src/test/java/org/zwobble/mammoth/tests/DeepReflectionMatcher.java
+++ b/src/test/java/org/zwobble/mammoth/tests/DeepReflectionMatcher.java
@@ -1,9 +1,11 @@
package org.zwobble.mammoth.tests;
-import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
-import org.hamcrest.*;
+import org.hamcrest.Description;
+import org.hamcrest.Matcher;
+import org.hamcrest.Matchers;
+import org.hamcrest.TypeSafeDiagnosingMatcher;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
@@ -13,9 +15,9 @@ import java.util.Optional;
import java.util.Set;
import static com.google.common.collect.Iterables.any;
-import static com.google.common.collect.Iterables.filter;
import static java.util.Arrays.asList;
import static org.zwobble.mammoth.internal.util.MammothIterables.lazyMap;
+import static org.zwobble.mammoth.internal.util.MammothLists.eagerFilter;
public class DeepReflectionMatcher<T> extends TypeSafeDiagnosingMatcher<T> {
public static <T> Matcher<T> deepEquals(T value) {
@@ -98,9 +100,9 @@ public class DeepReflectionMatcher<T> extends TypeSafeDiagnosingMatcher<T> {
}
private static <T> boolean matchesSet(String path, Set<?> expected, Set<?> actual, Description mismatchDescription) {
- List<?> missing = ImmutableList.copyOf(filter(
+ List<?> missing = eagerFilter(
expected,
- expectedElement -> !any(actual, actualElement -> deepEquals(expectedElement, actualElement))));
+ expectedElement -> !any(actual, actualElement -> deepEquals(expectedElement, actualElement)));
if (!missing.isEmpty()) {
appendPath(mismatchDescription, path);
@@ -109,9 +111,9 @@ public class DeepReflectionMatcher<T> extends TypeSafeDiagnosingMatcher<T> {
return false;
}
- List<?> extra = ImmutableList.copyOf(filter(
+ List<?> extra = eagerFilter(
actual,
- actualElement -> !any(expected, expectedElement -> deepEquals(expectedElement, actualElement))));
+ actualElement -> !any(expected, expectedElement -> deepEquals(expectedElement, actualElement)));
if (!extra.isEmpty()) {
appendPath(mismatchDescription, path);
@@ -234,10 +236,10 @@ public class DeepReflectionMatcher<T> extends TypeSafeDiagnosingMatcher<T> {
return value.replaceAll("\n", "\n ");
}
- private static ImmutableList<Field> fields(Class<?> clazz) {
- return ImmutableList.copyOf(filter(
+ private static List<Field> fields(Class<?> clazz) {
+ return eagerFilter(
asList(clazz.getDeclaredFields()),
- field -> !Modifier.isStatic(field.getModifiers())));
+ field -> !Modifier.isStatic(field.getModifiers()));
}
private static Object readField(Object obj, Field field) {