Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MissingInvocation occurs when with(new Delegate,..) api is used in Verifications. #730

Open
UchihaYong opened this issue Jul 15, 2022 · 0 comments

Comments

@UchihaYong
Copy link

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);
}
}
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant