This repository was archived by the owner on Sep 30, 2020. It is now read-only.

Description
There is a space character missing in the description of OptionalMatchers.contains(Matcher<T> matcher) before the description of the sub-matcher.
import org.junit.Test;
import java.util.Optional;
import static co.unruly.matchers.OptionalMatchers.contains;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
public class OptionalMatcherTest {
@Test
public void show_the_bug() {
assertThat(Optional.of("foo"), contains(equalTo("bar")));
}
}
This produces the following message:
java.lang.AssertionError:
Expected: Optional with an item that matches"bar"
but: was <Optional[foo]>
Expected :Optional with an item that matches"bar"
Actual :<Optional[foo]>
This gets very confusing when using a FeatureMatcher because the FeatureMatcher does not quote its description so it just becomes something like
Expected: Optional with an item that matchesbar
which can be pretty hard to read.