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))); } }