@Test
public void test() {
new NonStrictExpectations() {
{
aService.method1(anyString); result=abc
}
};
}
I am using Parameterized runner with jmockit. Now method1 of aService may or may not be invoked depending on test data. but jmockit throws MissingInvocation Exception.
In this case as per my new understanding I shouldn't be using Expectation block instead should be using faking and use faked instance in test.
Now aService can be used in test.