private ParameterSupplier getSupplier(ParameterSignature unassigned) throws Exception { ParametersSuppliedBy annotation = unassigned .findDeepAnnotation(ParametersSuppliedBy.class); if (annotation != null) { return buildParameterSupplierFromClass(annotation.value()); } else { return new AllMembersSupplier(fClass); } }
public ParameterSupplier getAnnotatedSupplier(ParameterSignature unassigned) throws InstantiationException, IllegalAccessException { ParametersSuppliedBy annotation = unassigned .findDeepAnnotation(ParametersSuppliedBy.class); if (annotation == null) { return null; } return annotation.value().newInstance(); }
@Theory public void adds_numbers(@ParametersSuppliedBy(NumberSupplier.class) Number num1, @ParametersSuppliedBy(NumberSupplier.class) Number num2) { System.out.println(num1 + " and " + num2); }
@Theory public void theoryMethod(@ParametersSuppliedBy(SimpleSupplier.class) String param) { }
@Theory public void theory(@ParametersSuppliedBy(SupplierWithUnknownConstructor.class) String param) { }
@Theory public void theory(@ParametersSuppliedBy(SupplierWithTwoConstructors.class) String param) { }
@Theory public void theory(@ParametersSuppliedBy(SupplierWithTestClassConstructor.class) String param) { }