MissingInvocation occurs when with(new Delegate,..) api is used in Verifications.
UchihaYong opened this issue · 0 comments
Hello,
The version is jmockit 1.9. When I upgrade the version to 1.36, the problem disappears,. But, I find out some usages of lower version are removed in higher version,so maybe the project will be in trouble. And the problem code as the following,
`public class XXXTest {
@mocked
Compute compute;
@test
public void test_X() {
new Expectations(){
{
compute.testRef((MockClazzOne) any);
result=1;
}
};
new HelloWorldMock().insertOneData(1);
new Verifications() {
{
compute.testRef(with(new Delegate(){
@OverRide
public boolean equals(Object o) {
MockClazzOne clazzOne = (MockClazzOne)o;
return clazzOne.getF1() == 1;
}
}));
times=1;
}
}
}
}
public class HelloWorldMock {
public int insertOneData(int f1) {
Compute compute = new Compute();
MockClassOne one = new MockClassOne();
one.setF1(f1);
return compute.testRef(one);
}
}
`