ReflectionUtil { public static MissingArgumentStrategy missingArgumentStrategy(Executable executable) { final Execute execute = executable.getAnnotation(Execute.class); final ExecuteBefore executeBefore = executable.getAnnotation(ExecuteBefore.class); if (execute != null) { return execute.missingArgument(); } else if (executeBefore != null) { return executeBefore.missingArgument(); } else { return MissingArgumentStrategy.THROW_EXCEPTION; } } private  ReflectionUtil(); static Stream<Field> traverseFields(Class<?> clazz); static Stream<Method> traverseMethods(Class<?> clazz); static Stream<Class<?>> traverseAncestors(Class<?> clazz); static MissingArgumentStrategy missingArgumentStrategy(Executable executable); static Optional<T> tryToCreate(Class<T> clazz, Properties properties, List<Object> instances, Set<Class<?>> allInjectableTypes, InjectorProxy injectorProxy); @SuppressWarnings("unchecked") static String errorMsg(Class<T> c, List<Object> instances); static Optional<Object> parse(Type type, String serialized);  }
@Test void missingArgumentStrategy() throws NoSuchMethodException { final Method method = Baz.class.getMethod("baz"); final MissingArgumentStrategy strategy = ReflectionUtil.missingArgumentStrategy(method); assertEquals(MissingArgumentStrategy.THROW_EXCEPTION, strategy); }
@Test void missingArgumentStrategyExecute() throws NoSuchMethodException { final Method method = Baz.class.getMethod("baz2"); final MissingArgumentStrategy strategy = ReflectionUtil.missingArgumentStrategy(method); assertEquals(MissingArgumentStrategy.SKIP_INVOCATION, strategy); }
@Test void missingArgumentStrategyExecuteBefore() throws NoSuchMethodException { final Method method = Baz.class.getMethod("baz3"); final MissingArgumentStrategy strategy = ReflectionUtil.missingArgumentStrategy(method); assertEquals(MissingArgumentStrategy.SKIP_INVOCATION, strategy); }