### Question:
ReflectionUtil { public static @NotNull List<String> getArgsForMethod(@NotNull List<String> args, @NotNull Method method) { if (args.size() == 0 && method.getParameterCount() == 0) { return Collections.emptyList(); } List<String> argsOut = new ArrayList<>(); if (args.size() < method.getParameterCount()) { argsOut.addAll(args); } else { for (int i = 0; i < method.getParameterCount(); i++) { argsOut.add(args.get(i)); } } return argsOut; }  static @NotNull List<String> getArgsForMethod(@NotNull List<String> args, @NotNull Method method); static @NotNull String getFormattedMethodSignature(Method method); static @NotNull String getMethodId(Method method); static @NotNull String getArgMismatchString(Method method);  }### Answer:
@Test public void ensureArgsForMethodAccurate() throws NoSuchMethodException { List<String> inputStr = Arrays.asList("1", "nextMethod", "param", "param2"); Method testClass1234 = ReflTestClass.ReflSubClass.class.getMethod("get1234", int.class); List<String> out = ReflectionUtil.getArgsForMethod(inputStr, testClass1234); assertEquals(1, out.size()); assertEquals("1", out.get(0)); inputStr = Arrays.asList("1", "2", "3"); Method lotsOfParams = ReflTestClass.class.getMethod("methodWithLotsOfParams", int.class, int.class, int.class, int.class, int.class, int.class, int.class); out = ReflectionUtil.getArgsForMethod(inputStr, lotsOfParams); assertEquals(inputStr.size(), out.size()); for (int i = 0; i < inputStr.size(); i++) { assertEquals(inputStr.get(i), out.get(i)); } inputStr = new ArrayList<>(); Method noParams = ReflTestClass.class.getMethod("getSomeNumbers"); out = ReflectionUtil.getArgsForMethod(inputStr, noParams); assertEquals(0, out.size()); }