RpcUtils { public static Object[] getArguments(Invocation invocation) { if ($INVOKE.equals(invocation.getMethodName()) && invocation.getArguments() != null && invocation.getArguments().length > 2 && invocation.getArguments()[2] instanceof Object[]) { return (Object[]) invocation.getArguments()[2]; } return invocation.getArguments(); }  static Class<?> getReturnType(Invocation invocation); static Type[] getReturnTypes(Invocation invocation); static Long getInvocationId(Invocation inv); static void attachInvocationIdIfAsync(URL url, Invocation inv); static String getMethodName(Invocation invocation); static Object[] getArguments(Invocation invocation); static Class<?>[] getParameterTypes(Invocation invocation); static boolean isAsync(URL url, Invocation inv); static boolean isReturnTypeFuture(Invocation inv); static boolean isGenericAsync(Invocation inv); static boolean isGenericCall(String parameterTypesDesc, String method); static boolean isEcho(String parameterTypesDesc, String method); static InvokeMode getInvokeMode(URL url, Invocation inv); static boolean isOneway(URL url, Invocation inv); static long getTimeout(Invocation invocation, long defaultTimeout); static long getTimeout(URL url, String methodName, RpcContext context, long defaultTimeout);  }
@Test public void testGet_$invoke_Arguments() { Object[] args = new Object[]{"hello", "dubbo", 520}; Class<?> demoServiceClass = DemoService.class; String serviceName = demoServiceClass.getName(); Invoker invoker = mock(Invoker.class); RpcInvocation inv = new RpcInvocation("$invoke", serviceName, "", new Class<?>[]{String.class, String[].class, Object[].class}, new Object[]{"method", new String[]{}, args}, null, invoker, null); Object[] arguments = RpcUtils.getArguments(inv); for (int i = 0; i < args.length; i++) { Assertions.assertNotNull(arguments[i]); Assertions.assertEquals(args[i].getClass().getName(), arguments[i].getClass().getName()); Assertions.assertEquals(args[i], arguments[i]); } }