### Question:
EitherMatchers { public static <S, T> Matcher<? super Either<S, T>> right() { return new EitherAnyRightMatcher<S, T>(); }  static Matcher<? super Either<S, T>> left(); static Matcher<? super Either<S, T>> left(S leftValue); static Matcher<? super Either<S, T>> leftOver(Class<S> leftClass, Class<T> rightClass); static Matcher<? super Either<S, T>> leftOverValueAndType(S leftValue, Class<T> rightClass); static Matcher<? super Either<S, T>> right(); static Matcher<? super Either<S, T>> right(T rightValue); static Matcher<? super Either<S, T>> rightOver(Class<S> leftClass, Class<T> rightClass); static Matcher<? super Either<S, T>> rightOverTypeAndValue(Class<S> leftClass, T rightValue);  }### Answer:
@Test public void shouldMatchWhenRightMatcherEvaluatesEitherWhichIsARightOverTheSpecificValue() throws Exception { Either<String, Integer> either = Either.right(10); Matcher<? super Either<String, Integer>> matcher = right(10); assertThat(matcher, successfullyMatches(either)); }
@Test public void shouldMatchWhenRightMatcherEvaluatesEitherWhichIsARightOverNullAndExpectedIsNull() throws Exception { Either<String, Integer> either = Either.right(null); Matcher<? super Either<String, Integer>> matcher = right(null); assertThat(matcher, successfullyMatches(either)); }
@Test public void shouldMismatchWithMessageWhenRightMatcherEvaluatesEitherWhichIsARightOverADifferentValue() throws Exception { Either<String, Integer> either = Either.right(30); Matcher<? super Either<String, Integer>> matcher = right(20); assertThat(matcher, mismatchesSampleWithMessage(either, "got Right with value: <30>")); }
@Test public void shouldMismatchWithMessageWhenRightMatcherEvaluatesEitherWhichIsRightOverAValueOtherThanNullButNullExpected() throws Exception { Either<String, Integer> either = Either.right(20); Matcher<? super Either<String, Integer>> matcher = right(null); assertThat(matcher, mismatchesSampleWithMessage(either, "got Right with value: <20>")); }
@Test public void shouldMismatchWithMessageWhenRightMatcherEvaluatesEitherWhichIsARightOverNull() throws Exception { Either<String, Integer> either = Either.right(null); Matcher<? super Either<String, Integer>> matcher = right(20); assertThat(matcher, mismatchesSampleWithMessage(either, "got Right with value: null")); }
@Test public void shouldProvideAdequateDescriptionWhenRightWithSpecificValueIsAskedToDescribeItself() throws Exception { Matcher<? super Either<String, Integer>> matcher = right(20); StringDescription description = new StringDescription(); matcher.describeTo(description); assertThat(description.toString(), is("Either to be Right with value: <20>")); }
@Test public void shouldMatchWhenRightMatcherEvaluatesEitherWhichIsARight() throws Exception { Either<String, Integer> either = Either.right(10); Matcher<? super Either<String, Integer>> matcher = right(); assertThat(matcher, successfullyMatches(either)); }
@Test public void shouldProvideAdequateDescriptionWhenRightIsAskedToDescribeItself() throws Exception { Matcher<? super Either<String, Integer>> matcher = right(); StringDescription description = new StringDescription(); matcher.describeTo(description); assertThat(description.toString(), is("Either to be Right.")); }