File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
main/java/org/hamcrest/core
test/java/org/hamcrest/core Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 5
5
import org .hamcrest .Matcher ;
6
6
import org .hamcrest .TypeSafeDiagnosingMatcher ;
7
7
8
- public class Every <T > extends TypeSafeDiagnosingMatcher <Iterable <T >> {
8
+ public class Every <T > extends TypeSafeDiagnosingMatcher <Iterable <? extends T >> {
9
9
private final Matcher <? super T > matcher ;
10
10
11
11
public Every (Matcher <? super T > matcher ) {
12
12
this .matcher = matcher ;
13
13
}
14
14
15
15
@ Override
16
- public boolean matchesSafely (Iterable <T > collection , Description mismatchDescription ) {
16
+ public boolean matchesSafely (Iterable <? extends T > collection , Description mismatchDescription ) {
17
17
for (T t : collection ) {
18
18
if (!matcher .matches (t )) {
19
19
mismatchDescription .appendText ("an item " );
@@ -40,7 +40,7 @@ public void describeTo(Description description) {
40
40
* the matcher to apply to every item provided by the examined {@link Iterable}
41
41
*/
42
42
@ Factory
43
- public static <U > Matcher <Iterable <U >> everyItem (final Matcher <U > itemMatcher ) {
43
+ public static <U > Matcher <Iterable <? extends U >> everyItem (final Matcher <U > itemMatcher ) {
44
44
return new Every <U >(itemMatcher );
45
45
}
46
46
}
Original file line number Diff line number Diff line change 16
16
17
17
public final class EveryTest {
18
18
19
- private final Matcher <Iterable <String >> matcher = Every .everyItem (containsString ("a" ));
19
+ private final Matcher <Iterable <? extends String >> matcher = Every .everyItem (containsString ("a" ));
20
20
21
21
@ Test public void
22
22
copesWithNullsAndUnknownTypes () {
You can’t perform that action at this time.
0 commit comments