Skip to content

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

@UchihaYong

Description

@UchihaYong

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions