You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In particular, this means, for example, that one cannot use Matcher<Iterable<T>> in places where Matcher<Collection<T>> is expected, or even the most primitive Matchers.notNullValue(). The only other remedy is to declare a matcher per type, or "monomorphise" it.
This was already brought up some years ago, but then was closed, as MockitoHamcrest was planned for deprecation anyway. After some discussion in #1819, the deprecation commit was reverted in ad2f352. However, the issue remained unaddressed, and so the problem is still there.
The text was updated successfully, but these errors were encountered:
@foaw This is a problem that I also experience on a regular basis, and I find myself using the above helper method in these situations. However the fix would be really simple, would likely not break any code, and would make using hamcrest matchers a lot easier. I for one would like to see this merged in Mockito (but I'm not a maintainer). Maybe open a PR with this?
The current signature of
MockitoHamcrest#argThat
makes it impossible to pass in arguments that are not directly of typeT
.mockito/src/main/java/org/mockito/hamcrest/MockitoHamcrest.java
Lines 77 to 81 in f5449f9
In particular, this means, for example, that one cannot use
Matcher<Iterable<T>>
in places whereMatcher<Collection<T>>
is expected, or even the most primitiveMatchers.notNullValue()
. The only other remedy is to declare a matcher per type, or "monomorphise" it.This was already brought up some years ago, but then was closed, as
MockitoHamcrest
was planned for deprecation anyway. After some discussion in #1819, the deprecation commit was reverted in ad2f352. However, the issue remained unaddressed, and so the problem is still there.The text was updated successfully, but these errors were encountered: