diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-02-24 21:56:31 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-02-24 23:24:20 +0000 |
| commit | 56dad2617a86aeb83cf4f7f56519af621979851d (patch) | |
| tree | 618e572381fa70f868a03e020c61b38fee4b8028 /src/test/java/org/zwobble/mammoth/tests/ResultMatchers.java | |
| parent | cc66aa555d68eb33dfceb052e5dc37284e5080bd (diff) | |
Use Set instead of List for warnings
Diffstat (limited to 'src/test/java/org/zwobble/mammoth/tests/ResultMatchers.java')
| -rw-r--r-- | src/test/java/org/zwobble/mammoth/tests/ResultMatchers.java | 21 |
1 files changed, 21 insertions, 0 deletions
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<Result<?>> isResult(Matcher<?> valueMatcher, Iterable<String> warnings) { + return Matchers.allOf( + hasProperty("value", valueMatcher), + hasWarnings(warnings)); + } + + public static Matcher<Result<?>> hasWarnings(Iterable<String> warnings) { + return hasProperty("warnings", deepEquals(ImmutableSet.copyOf(warnings))); + } +} |
