Skip to content
This repository was archived by the owner on Sep 30, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/main/java/co/unruly/matchers/StreamMatchers.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

public class StreamMatchers {

public static <T,S extends BaseStream<T,S>> Matcher<BaseStream<T,S>> empty() {
return new TypeSafeMatcher<BaseStream<T, S>>() {
public static <T,S extends BaseStream<T,S>> Matcher<S> empty() {
return new TypeSafeMatcher<S>() {

private Iterator<T> actualIterator;

@Override
protected boolean matchesSafely(BaseStream<T, S> actual) {
protected boolean matchesSafely(S actual) {
actualIterator = actual.iterator();
return !actualIterator.hasNext();
}
Expand All @@ -30,7 +30,7 @@ public void describeTo(Description description) {
}

@Override
protected void describeMismatchSafely(BaseStream<T, S> item, Description description) {
protected void describeMismatchSafely(S item, Description description) {
description.appendText("A non empty Stream starting with ").appendValue(actualIterator.next());
}
};
Expand All @@ -50,10 +50,10 @@ protected void describeMismatchSafely(BaseStream<T, S> item, Description descrip
* @see #startsWithLong
* @see #startsWithDouble
*/
public static <T,S extends BaseStream<T,S>> Matcher<BaseStream<T,S>> equalTo(BaseStream<T, S> expected) {
return new BaseStreamMatcher<T,BaseStream<T,S>>() {
public static <T,S extends BaseStream<T,S>> Matcher<S> equalTo(S expected) {
return new BaseStreamMatcher<T,S>() {
@Override
protected boolean matchesSafely(BaseStream<T,S> actual) {
protected boolean matchesSafely(S actual) {
return remainingItemsEqual(expected.iterator(), actual.iterator());
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/co/unruly/matchers/StreamMatchersTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public void startsWithItemsIntStream_success() throws Exception {

@Test
public void equalTo_failureMessages() throws Exception {
Matcher<BaseStream<String, Stream<String>>> matcher = equalTo(Stream.of("a", "b", "c", "d", "e", "f", "g", "h"));
Matcher<Stream<String>> matcher = equalTo(Stream.of("a", "b", "c", "d", "e", "f", "g", "h"));
Stream<String> testData = Stream.of("a", "b", "c", "d", "e");
Helper.testFailingMatcher(testData, matcher, "Stream of [\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\",\"h\"]", "Stream of [\"a\",\"b\",\"c\",\"d\",\"e\"]");
}
Expand All @@ -224,7 +224,7 @@ public void contains_failureMessages() throws Exception {
@Test
public void equalToIntStream_failureMessages() throws Exception {
IntStream testData = IntStream.range(8, 10);
Matcher<BaseStream<Integer, IntStream>> matcher = equalTo(IntStream.range(0, 6));
Matcher<IntStream> matcher = equalTo(IntStream.range(0, 6));
Helper.testFailingMatcher(testData, matcher, "Stream of [<0>,<1>,<2>,<3>,<4>,<5>]", "Stream of [<8>,<9>]");
}

Expand Down