@Test public void testByMethod() throws ScriptException, NoSuchMethodException { Method method = TestMethod.class.getMethod("doSomething", String.class, int.class); MethodExecutionStrategy methodExecutionStrategy = MethodExecutionStrategy.byMethod(method, "Hello", 42); TestMethod instance = new TestMethod(); Object result = methodExecutionStrategy.execute(instance); assertThat(result).isEqualTo("doSomething(Hello,42)"); }
public static MethodExecutionStrategy byMethod(Method method, Object... arguments) { return new MethodExecutionStrategy(method, arguments); }
MethodExecutionStrategy implements ExecutionStrategy { public static MethodExecutionStrategy byMethod(Method method, Object... arguments) { return new MethodExecutionStrategy(method, arguments); } }
MethodExecutionStrategy implements ExecutionStrategy { public static MethodExecutionStrategy byMethod(Method method, Object... arguments) { return new MethodExecutionStrategy(method, arguments); } private  MethodExecutionStrategy(Method method, Object... arguments); }
MethodExecutionStrategy implements ExecutionStrategy { public static MethodExecutionStrategy byMethod(Method method, Object... arguments) { return new MethodExecutionStrategy(method, arguments); } private  MethodExecutionStrategy(Method method, Object... arguments); @Override Object execute(Object instance); static MethodExecutionStrategy byMethod(Method method, Object... arguments); static MethodExecutionStrategy byMainMethod(Class<?> clazz, String... arguments); static MethodExecutionStrategy byArgumentTypes(Class<?> clazz, String methodName, Class<?>[] argumentTypes, Object... arguments); static MethodExecutionStrategy byMatchingArguments(Class<?> clazz, String methodName, Object... arguments); }
MethodExecutionStrategy implements ExecutionStrategy { public static MethodExecutionStrategy byMethod(Method method, Object... arguments) { return new MethodExecutionStrategy(method, arguments); } private  MethodExecutionStrategy(Method method, Object... arguments); @Override Object execute(Object instance); static MethodExecutionStrategy byMethod(Method method, Object... arguments); static MethodExecutionStrategy byMainMethod(Class<?> clazz, String... arguments); static MethodExecutionStrategy byArgumentTypes(Class<?> clazz, String methodName, Class<?>[] argumentTypes, Object... arguments); static MethodExecutionStrategy byMatchingArguments(Class<?> clazz, String methodName, Object... arguments);  }