From 56dad2617a86aeb83cf4f7f56519af621979851d Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 24 Feb 2016 21:56:31 +0000 Subject: Use Set instead of List for warnings --- .../org/zwobble/mammoth/tests/ResultMatchers.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/test/java/org/zwobble/mammoth/tests/ResultMatchers.java (limited to 'src/test/java/org/zwobble/mammoth/tests/ResultMatchers.java') diff --git a/src/test/java/org/zwobble/mammoth/tests/ResultMatchers.java b/src/test/java/org/zwobble/mammoth/tests/ResultMatchers.java new file mode 100644 index 0000000..a5b9585 --- /dev/null +++ b/src/test/java/org/zwobble/mammoth/tests/ResultMatchers.java @@ -0,0 +1,21 @@ +package org.zwobble.mammoth.tests; + +import com.google.common.collect.ImmutableSet; +import org.hamcrest.Matcher; +import org.hamcrest.Matchers; +import org.zwobble.mammoth.Result; + +import static org.hamcrest.Matchers.hasProperty; +import static org.zwobble.mammoth.tests.DeepReflectionMatcher.deepEquals; + +public class ResultMatchers { + public static Matcher> isResult(Matcher valueMatcher, Iterable warnings) { + return Matchers.allOf( + hasProperty("value", valueMatcher), + hasWarnings(warnings)); + } + + public static Matcher> hasWarnings(Iterable warnings) { + return hasProperty("warnings", deepEquals(ImmutableSet.copyOf(warnings))); + } +} -- cgit v1.2.3