mirror of
https://github.com/alibaba/testable-mock.git
synced 2025-01-10 20:30:11 +08:00
skip type comparation for macher
This commit is contained in:
parent
f63b694b0c
commit
525e252f96
@ -119,7 +119,7 @@ public class InvokeVerifier {
|
|||||||
for (Object[] r : records) {
|
for (Object[] r : records) {
|
||||||
if (r.length == args.length) {
|
if (r.length == args.length) {
|
||||||
for (int i = 0; i < r.length; i++) {
|
for (int i = 0; i < r.length; i++) {
|
||||||
if (!matches(r[i], args[i])) {
|
if (!matches(args[i], r[i])) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i == r.length - 1) {
|
if (i == r.length - 1) {
|
||||||
@ -178,7 +178,7 @@ public class InvokeVerifier {
|
|||||||
throw new VerifyFailedError(desc(args), desc(record));
|
throw new VerifyFailedError(desc(args), desc(record));
|
||||||
}
|
}
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (int i = 0; i < args.length; i++) {
|
||||||
if (!args[i].getClass().equals(record[i].getClass())) {
|
if (!(args[i] instanceof InvokeMatcher || args[i].getClass().equals(record[i].getClass()))) {
|
||||||
throw new VerifyFailedError("parameter " + (i + 1) + " type mismatch",
|
throw new VerifyFailedError("parameter " + (i + 1) + " type mismatch",
|
||||||
": " + args[i].getClass(), ": " + record[i].getClass());
|
": " + args[i].getClass(), ": " + record[i].getClass());
|
||||||
}
|
}
|
||||||
@ -189,7 +189,7 @@ public class InvokeVerifier {
|
|||||||
records.remove(order);
|
records.remove(order);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean matches(Object realValue, Object expectValue) {
|
private boolean matches(Object expectValue, Object realValue) {
|
||||||
return expectValue instanceof InvokeMatcher ?
|
return expectValue instanceof InvokeMatcher ?
|
||||||
((InvokeMatcher) expectValue).matchFunction.check(realValue) :
|
((InvokeMatcher) expectValue).matchFunction.check(realValue) :
|
||||||
expectValue.equals(realValue);
|
expectValue.equals(realValue);
|
||||||
|
Loading…
Reference in New Issue
Block a user