/** * Returns an object responsible for performing sanity tests against the return values of all * public static methods declared by {@code cls}, excluding superclasses. */ public FactoryMethodReturnValueTester forAllPublicStaticMethods(Class<?> cls) { ImmutableList.Builder<Invokable<?, ?>> builder = ImmutableList.builder(); for (Method method : cls.getDeclaredMethods()) { Invokable<?, ?> invokable = Invokable.from(method); invokable.setAccessible(true); if (invokable.isPublic() && invokable.isStatic() && !invokable.isSynthetic()) { builder.add(invokable); } } return new FactoryMethodReturnValueTester(cls, builder.build(), "public static methods"); }
/** * Returns an object responsible for performing sanity tests against the return values of all * public static methods declared by {@code cls}, excluding superclasses. */ public FactoryMethodReturnValueTester forAllPublicStaticMethods(Class<?> cls) { ImmutableList.Builder<Invokable<?, ?>> builder = ImmutableList.builder(); for (Method method : cls.getDeclaredMethods()) { Invokable<?, ?> invokable = Invokable.from(method); invokable.setAccessible(true); if (invokable.isPublic() && invokable.isStatic() && !invokable.isSynthetic()) { builder.add(invokable); } } return new FactoryMethodReturnValueTester(cls, builder.build(), "public static methods"); }
/** * Returns an object responsible for performing sanity tests against the return values * of all public static methods declared by {@code cls}, excluding superclasses. */ public FactoryMethodReturnValueTester forAllPublicStaticMethods(Class<?> cls) { ImmutableList.Builder<Invokable<?, ?>> builder = ImmutableList.builder(); for (Method method : cls.getDeclaredMethods()) { Invokable<?, ?> invokable = Invokable.from(method); invokable.setAccessible(true); if (invokable.isPublic() && invokable.isStatic() && !invokable.isSynthetic()) { builder.add(invokable); } } return new FactoryMethodReturnValueTester(cls, builder.build(), "public static methods"); }