File tree Expand file tree Collapse file tree
main/java/org/hamcrest/core
test/java/org/hamcrest/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55import org .hamcrest .Matcher ;
66import org .hamcrest .TypeSafeDiagnosingMatcher ;
77
8- public class Every <T > extends TypeSafeDiagnosingMatcher <Iterable <T >> {
8+ public class Every <T > extends TypeSafeDiagnosingMatcher <Iterable <? extends T >> {
99 private final Matcher <? super T > matcher ;
1010
1111 public Every (Matcher <? super T > matcher ) {
1212 this .matcher = matcher ;
1313 }
1414
1515 @ Override
16- public boolean matchesSafely (Iterable <T > collection , Description mismatchDescription ) {
16+ public boolean matchesSafely (Iterable <? extends T > collection , Description mismatchDescription ) {
1717 for (T t : collection ) {
1818 if (!matcher .matches (t )) {
1919 mismatchDescription .appendText ("an item " );
@@ -41,7 +41,7 @@ public void describeTo(Description description) {
4141 * the matcher to apply to every item provided by the examined {@link Iterable}
4242 */
4343 @ Factory
44- public static <U > Matcher <Iterable <U >> everyItem (final Matcher <U > itemMatcher ) {
44+ public static <U > Matcher <Iterable <? extends U >> everyItem (final Matcher <U > itemMatcher ) {
4545 return new Every <U >(itemMatcher );
4646 }
4747}
Original file line number Diff line number Diff line change 1616
1717public final class EveryTest {
1818
19- private final Matcher <Iterable <String >> matcher = Every .everyItem (containsString ("a" ));
19+ private final Matcher <Iterable <? extends String >> matcher = Every .everyItem (containsString ("a" ));
2020
2121 @ Test public void
2222 copesWithNullsAndUnknownTypes () {
You can’t perform that action at this time.
0 commit comments