After upgrading to Java 8. I now have compile errors of the following kind:
The method with(Matcher<Object>) is ambiguous for the type new Expectations(){}
It is caused by this method call:
import org.jmock.Expectations;
public class Ambiguous {
public static void main(String[] args) {
Expectations expectations = new Expectations();
expectations.with(org.hamcrest.Matchers.instanceOf(Integer.class));
}
}
It seems like with is returned from instanceOf()
is ambiguous from what with()
expects, or vice versa. Is there a way to fix this?
instanceof
:expectations.with(org.hamcrest.Matchers.<Integer>instanceOf(Integer.class))
. – Kantian