test_class.file: dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/support/MockInvokerTest.java
test_class.identifier: MockInvokerTest
test_case.body: @Test
      public void testInvokeThrowsRpcException1() {
          URL url = URL.valueOf("remote://1.2.3.4/" + String.class.getName());
          MockInvoker mockInvoker = new MockInvoker(url, null);
  
          Assertions.assertThrows(RpcException.class,
                  () -> mockInvoker.invoke(new RpcInvocation()));
      }
test_case.class_method_signature: MockInvokerTest.testInvokeThrowsRpcException1()
test_case.full_signature: @Test public void testInvokeThrowsRpcException1()
test_case.identifier: testInvokeThrowsRpcException1
test_case.invocations: valueOf getName assertThrows invoke
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testInvokeThrowsRpcException1()
focal_class.declarator: PROXY_FACTORY = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension()
focal_class.modifier: private final static
focal_class.original_string: private final static ProxyFactory PROXY_FACTORY = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension();
focal_class.type: ProxyFactory
focal_class.var_name: PROXY_FACTORY
focal_class.declarator: MOCK_MAP = new ConcurrentHashMap<String, Invoker<?>>()
focal_class.modifier: private final static
focal_class.original_string: private final static Map<String, Invoker<?>> MOCK_MAP = new ConcurrentHashMap<String, Invoker<?>>();
focal_class.type: Map<String, Invoker<?>>
focal_class.var_name: MOCK_MAP
focal_class.declarator: THROWABLE_MAP = new ConcurrentHashMap<String, Throwable>()
focal_class.modifier: private final static
focal_class.original_string: private final static Map<String, Throwable> THROWABLE_MAP = new ConcurrentHashMap<String, Throwable>();
focal_class.type: Map<String, Throwable>
focal_class.var_name: THROWABLE_MAP
focal_class.declarator: url
focal_class.modifier: private final
focal_class.original_string: private final URL url;
focal_class.type: URL
focal_class.var_name: url
focal_class.declarator: type
focal_class.modifier: private final
focal_class.original_string: private final Class<T> type;
focal_class.type: Class<T>
focal_class.var_name: type
focal_class.file: dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/support/MockInvoker.java
focal_class.identifier: MockInvoker
focal_class.interfaces: implements Invoker<T>
focal_class.class_method_signature: MockInvoker.MockInvoker(URL url, Class<T> type)
focal_class.full_signature: public  MockInvoker(URL url, Class<T> type)
focal_class.identifier: MockInvoker
focal_class.modifiers: public
focal_class.parameters: (URL url, Class<T> type)
focal_class.signature:  MockInvoker(URL url, Class<T> type)
focal_class.class_method_signature: MockInvoker.parseMockValue(String mock)
focal_class.full_signature: public static Object parseMockValue(String mock)
focal_class.identifier: parseMockValue
focal_class.modifiers: public static
focal_class.parameters: (String mock)
focal_class.return: Object
focal_class.signature: Object parseMockValue(String mock)
focal_class.class_method_signature: MockInvoker.parseMockValue(String mock, Type[] returnTypes)
focal_class.full_signature: public static Object parseMockValue(String mock, Type[] returnTypes)
focal_class.identifier: parseMockValue
focal_class.modifiers: public static
focal_class.parameters: (String mock, Type[] returnTypes)
focal_class.return: Object
focal_class.signature: Object parseMockValue(String mock, Type[] returnTypes)
focal_class.class_method_signature: MockInvoker.invoke(Invocation invocation)
focal_class.full_signature: @Override public Result invoke(Invocation invocation)
focal_class.identifier: invoke
focal_class.modifiers: @Override public
focal_class.parameters: (Invocation invocation)
focal_class.return: Result
focal_class.signature: Result invoke(Invocation invocation)
focal_class.class_method_signature: MockInvoker.getThrowable(String throwstr)
focal_class.full_signature: public static Throwable getThrowable(String throwstr)
focal_class.identifier: getThrowable
focal_class.modifiers: public static
focal_class.parameters: (String throwstr)
focal_class.return: Throwable
focal_class.signature: Throwable getThrowable(String throwstr)
focal_class.class_method_signature: MockInvoker.getInvoker(String mockService)
focal_class.full_signature: @SuppressWarnings("unchecked") private Invoker<T> getInvoker(String mockService)
focal_class.identifier: getInvoker
focal_class.modifiers: @SuppressWarnings("unchecked") private
focal_class.parameters: (String mockService)
focal_class.return: Invoker<T>
focal_class.signature: Invoker<T> getInvoker(String mockService)
focal_class.class_method_signature: MockInvoker.getMockObject(String mockService, Class serviceType)
focal_class.full_signature: @SuppressWarnings("unchecked") public static Object getMockObject(String mockService, Class serviceType)
focal_class.identifier: getMockObject
focal_class.modifiers: @SuppressWarnings("unchecked") public static
focal_class.parameters: (String mockService, Class serviceType)
focal_class.return: Object
focal_class.signature: Object getMockObject(String mockService, Class serviceType)
focal_class.class_method_signature: MockInvoker.normalizeMock(String mock)
focal_class.full_signature: public static String normalizeMock(String mock)
focal_class.identifier: normalizeMock
focal_class.modifiers: public static
focal_class.parameters: (String mock)
focal_class.return: String
focal_class.signature: String normalizeMock(String mock)
focal_class.class_method_signature: MockInvoker.getUrl()
focal_class.full_signature: @Override public URL getUrl()
focal_class.identifier: getUrl
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: URL
focal_class.signature: URL getUrl()
focal_class.class_method_signature: MockInvoker.isAvailable()
focal_class.full_signature: @Override public boolean isAvailable()
focal_class.identifier: isAvailable
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isAvailable()
focal_class.class_method_signature: MockInvoker.destroy()
focal_class.full_signature: @Override public void destroy()
focal_class.identifier: destroy
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void destroy()
focal_class.class_method_signature: MockInvoker.getInterface()
focal_class.full_signature: @Override public Class<T> getInterface()
focal_class.identifier: getInterface
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Class<T>
focal_class.signature: Class<T> getInterface()
focal_method.body: @Override
      public Result invoke(Invocation invocation) throws RpcException {
          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);
          }
  
          if (StringUtils.isBlank(mock)) {
              throw new RpcException(new IllegalAccessException("mock can not be null. url :" + url));
          }
          mock = normalizeMock(URL.decode(mock));
          if (mock.startsWith(RETURN_PREFIX)) {
              mock = mock.substring(RETURN_PREFIX.length()).trim();
              try {
                  Type[] returnTypes = RpcUtils.getReturnTypes(invocation);
                  Object value = parseMockValue(mock, returnTypes);
                  return AsyncRpcResult.newDefaultAsyncResult(value, invocation);
              } catch (Exception ew) {
                  throw new RpcException("mock return invoke error. method :" + invocation.getMethodName()
                          + ", mock:" + mock + ", url: " + url, ew);
              }
          } else if (mock.startsWith(THROW_PREFIX)) {
              mock = mock.substring(THROW_PREFIX.length()).trim();
              if (StringUtils.isBlank(mock)) {
                  throw new RpcException("mocked exception for service degradation.");
              } else { // user customized class
                  Throwable t = getThrowable(mock);
                  throw new RpcException(RpcException.BIZ_EXCEPTION, t);
              }
          } else { //impl mock
              try {
                  Invoker<T> invoker = getInvoker(mock);
                  return invoker.invoke(invocation);
              } catch (Throwable t) {
                  throw new RpcException("Failed to create mock implementation class " + mock, t);
              }
          }
      }
focal_method.class_method_signature: MockInvoker.invoke(Invocation invocation)
focal_method.full_signature: @Override public Result invoke(Invocation invocation)
focal_method.identifier: invoke
focal_method.invocations: setInvoker hasMethodParameter getUrl getMethodName getParameter getUrl getMethodName isBlank getParameter getUrl isBlank normalizeMock decode startsWith trim substring length getReturnTypes parseMockValue newDefaultAsyncResult getMethodName startsWith trim substring length isBlank getThrowable getInvoker invoke
focal_method.modifiers: @Override public
focal_method.parameters: (Invocation invocation)
focal_method.return: Result
focal_method.signature: Result invoke(Invocation invocation)