Optimize the logic of obtaining the mock parameter value of the corresponding method in the MockInvoker#invoke method (#7840)

This commit is contained in:
灼华 2021-05-23 21:18:18 +08:00 committed by GitHub
parent 18c1bd5679
commit 0049c24e88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 7 deletions

View File

@ -99,13 +99,8 @@ final public class MockInvoker<T> implements Invoker<T> {
if (invocation instanceof RpcInvocation) {
((RpcInvocation) invocation).setInvoker(this);
}
String mock = null;
if (getUrl().hasMethodParameter(invocation.getMethodName())) {
mock = getUrl().getParameter(invocation.getMethodName() + "." + MOCK_KEY);
}
if (StringUtils.isBlank(mock)) {
mock = getUrl().getParameter(MOCK_KEY);
}
String mock = getUrl().getMethodParameter(invocation.getMethodName(),MOCK_KEY);
if (StringUtils.isBlank(mock)) {
throw new RpcException(new IllegalAccessException("mock can not be null. url :" + url));