@Override public void validatePublicVoid(boolean isStatic, List<Throwable> errors) { delegatee.validatePublicVoid( isStatic, errors ); }
@Override protected void validateTestMethods(List<Throwable> errors) { for (FrameworkMethod each : computeTestMethods()) { if (each.getAnnotation(Theory.class) != null) { each.validatePublicVoid(false, errors); } else { each.validatePublicVoidNoArg(false, errors); } } }
/** * Adds to {@code errors} if this method: * <ul> * <li>is not public, or * <li>takes parameters, or * <li>returns something other than void, or * <li>is static (given {@code isStatic is false}), or * <li>is not static (given {@code isStatic is true}). * </ul> */ public void validatePublicVoidNoArg(boolean isStatic, List<Throwable> errors) { validatePublicVoid(isStatic, errors); if (method.getParameterTypes().length != 0) { errors.add(new Exception("Method " + method.getName() + " should have no parameters")); } }
testMethod.validatePublicVoid(false, errors); if (testMethod.getMethod().getParameterTypes().length <= 0) { errors.add(new Exception(String.format("Method %s() must have at least one argument for dataprovider",
/** * Adds to {@code errors} if this method: * <ul> * <li>is not public, or * <li>takes parameters, or * <li>returns something other than void, or * <li>is static (given {@code isStatic is false}), or * <li>is not static (given {@code isStatic is true}). */ public void validatePublicVoidNoArg(boolean isStatic, List<Throwable> errors) { validatePublicVoid(isStatic, errors); if (fMethod.getParameterTypes().length != 0) { errors.add(new Exception("Method " + fMethod.getName() + " should have no parameters")); } }
@Override protected void validateTestMethods(List<Throwable> errors) { for (FrameworkMethod each : computeTestMethods()) { if (each.getAnnotation(Theory.class) != null) { each.validatePublicVoid(false, errors); each.validateNoTypeParametersOnArgs(errors); } else { each.validatePublicVoidNoArg(false, errors); } for (ParameterSignature signature : ParameterSignature.signatures(each.getMethod())) { ParametersSuppliedBy annotation = signature.findDeepAnnotation(ParametersSuppliedBy.class); if (annotation != null) { validateParameterSupplier(annotation.value(), errors); } } } }
private void validatePublicStaticVoidMethods( Class<? extends Annotation> annotation, Integer parameterCount, List<Throwable> errors) { List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(annotation); for (FrameworkMethod fm : methods) { fm.validatePublicVoid(true, errors); if (parameterCount != null) { int methodParameterCount = fm.getMethod().getParameterTypes().length; if (methodParameterCount != 0 && methodParameterCount != parameterCount) { errors.add(new Exception("Method " + fm.getName() + "() should have 0 or " + parameterCount + " parameter(s)")); } } } }
@Override protected void validateTestMethods(List<Throwable> errors) { for (FrameworkMethod each : computeTestMethods()) { if (each.getAnnotation(Theory.class) != null) { each.validatePublicVoid(false, errors); } else { each.validatePublicVoidNoArg(false, errors); } } }
/** * Adds to {@code errors} if this method: * <ul> * <li>is not public, or * <li>takes parameters, or * <li>returns something other than void, or * <li>is static (given {@code isStatic is false}), or * <li>is not static (given {@code isStatic is true}). */ public void validatePublicVoidNoArg(boolean isStatic, List<Throwable> errors) { validatePublicVoid(isStatic, errors); if (fMethod.getParameterTypes().length != 0) { errors.add(new Exception("Method " + fMethod.getName() + " should have no parameters")); } }
@Override protected void validateTestMethods(List<Throwable> errors) { for (FrameworkMethod each : computeTestMethods()) { if (each.getAnnotation(Theory.class) != null) { each.validatePublicVoid(false, errors); } else { each.validatePublicVoidNoArg(false, errors); } } }
private void validatePropertyMethods(List<Throwable> errors) { for (FrameworkMethod each : getTestClass().getAnnotatedMethods(Property.class)) each.validatePublicVoid(false, errors); }
private static void validateStateChangeMethods(TestClass testClass, final List<Throwable> errors) { getAnnotatedMethods(testClass, State.class).forEach(method -> { method.validatePublicVoid(false, errors); if (method.getMethod().getParameterCount() == 1 && !Map.class.isAssignableFrom(method.getMethod().getParameterTypes()[0])) { errors.add(new Exception("Method " + method.getName() + " should take only a single Map parameter")); } else if (method.getMethod().getParameterCount() > 1) { errors.add(new Exception("Method " + method.getName() + " should either take no parameters or a single Map parameter")); } }); }
/** * Override to allow test methods with arguments */ @Override protected void validatePublicVoidNoArgMethods(Class<? extends Annotation> annotation, boolean isStatic, List<Throwable> errors) { List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(annotation); for (FrameworkMethod eachTestMethod : methods) { eachTestMethod.validatePublicVoid(isStatic, errors); } }
@Override protected void validatePublicVoidNoArgMethods(Class<? extends Annotation> annotation, boolean isStatic, List<Throwable> errors) { // Overrides the default validation to allow test methods with // parameters so that we can inject CDI references. List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(annotation); for (FrameworkMethod eachTestMethod : methods) { eachTestMethod.validatePublicVoid(isStatic, errors); } }
@Override protected void validatePublicVoidNoArgMethods(Class<? extends Annotation> annotation, boolean isStatic, List<Throwable> errors) { final List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(annotation); for (final FrameworkMethod eachTestMethod : methods) { eachTestMethod.validatePublicVoid(isStatic, errors); } }
private void validatePublicVoidMethods(Class<? extends Annotation> annotation, boolean isStatic, List<Throwable> errors) { List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(annotation); for (FrameworkMethod eachTestMethod : methods) eachTestMethod.validatePublicVoid(isStatic, errors); }
@Override protected void validateTestMethods(List<Throwable> errors) { List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(Test.class); for (FrameworkMethod eachTestMethod : methods) { eachTestMethod.validatePublicVoid(false, errors); } }
private void validateFuzzMethods(List<Throwable> errors) { for (FrameworkMethod method : getTestClass().getAnnotatedMethods(Fuzz.class)) { method.validatePublicVoid(false, errors); if (method.getAnnotation(Property.class) != null) { errors.add(new Exception("Method " + method.getName() + " cannot have both @Property and @Fuzz annotations")); } } }
protected void validatePublicVoidNoOrServiceContextArgMethods(Class<? extends Annotation> annotation, boolean isStatic, List<Throwable> errors) { List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(annotation); for (FrameworkMethod eachTestMethod : methods) { eachTestMethod.validatePublicVoid(isStatic, errors); validateNoOrOneServiceContextArg(eachTestMethod, errors); } }
private void validatePublicStaticVoidMethods(Class<? extends Annotation> annotation, List<Throwable> errors) { final List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(annotation); for (FrameworkMethod eachTestMethod : methods) { eachTestMethod.validatePublicVoid(true, errors); } }