allow to check method never invoke with parameters

This commit is contained in:
金戟 2020-11-07 23:24:53 +08:00
parent ba2a823c19
commit 88fddf2bcc

View File

@ -90,6 +90,24 @@ public class InvokeVerifier {
return this;
}
/**
* Expect mock method had never invoked with specified parameters
* @param args parameters to compare
*/
public InvokeVerifier without(Object[] args) {
for (Object[] r : records) {
if (r.length == args.length) {
for (int i = 0; i < r.length; i++) {
if (!r[i].equals(args[i])) {
break;
}
}
throw new VerifyFailedError("was invoked with " + desc(args));
}
}
return this;
}
/**
* Expect mock method have been invoked specified times
* @param expectedCount times to compare