@Override public void validatePublicVoidNoArg(boolean isStatic, List<Throwable> errors) { delegatee.validatePublicVoidNoArg( isStatic, errors ); }
/** * Adds to {@code errors} if any method in this class is annotated with * {@code annotation}, but: * <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}). */ protected void validatePublicVoidNoArgMethods(Class<? extends Annotation> annotation, boolean isStatic, List<Throwable> errors) { List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(annotation); for (FrameworkMethod eachTestMethod : methods) { eachTestMethod.validatePublicVoidNoArg(isStatic, errors); } }
/** * Adds to {@code errors} if any method in this class is annotated with * {@code annotation}, but: * <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> */ protected void validatePublicVoidNoArgMethods(Class<? extends Annotation> annotation, boolean isStatic, List<Throwable> errors) { List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(annotation); for (FrameworkMethod eachTestMethod : methods) { eachTestMethod.validatePublicVoidNoArg(isStatic, errors); } }
testMethod.validatePublicVoidNoArg(false, 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); } } }
@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); } } } }
/** * Adds to {@code errors} if any method in this class is annotated with * {@code annotation}, but: * <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}). */ protected void validatePublicVoidNoArgMethods(Class<? extends Annotation> annotation, boolean isStatic, List<Throwable> errors) { List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(annotation); for (FrameworkMethod eachTestMethod : methods) { eachTestMethod.validatePublicVoidNoArg(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); } } }
@Override public void validatePublicVoidNoArg(final boolean isStatic, final List<Throwable> errors) { delegate.validatePublicVoidNoArg(isStatic, errors); }
public void validate(final TestClass testClass, final List<Throwable> errors) { final List<FrameworkMethod> methods = testClass.getAnnotatedMethods(annotationClass); for (final FrameworkMethod method : methods) { method.validatePublicVoidNoArg(isStatic, errors); } } }
private void verifyMethodCanBeRunByStandardRunner(TestMethod testMethod) { List<Throwable> errors = new ArrayList<Throwable>(); testMethod.frameworkMethod().validatePublicVoidNoArg(false, errors); if (!errors.isEmpty()) { throw new RuntimeException(errors.get(0)); } }
protected void validatePublicVoidNoArgMethods(final Class<? extends Annotation> annotation, final boolean isStatic, final List<Throwable> errors) { testClass.getAnnotatedMethods(annotation).forEach(method -> method.validatePublicVoidNoArg(isStatic, errors)); }
/** * Adds to {@code errors} for each method annotated with {@code @Test}that * is not a public, void instance method with no arguments. */ @Override protected void validateTestMethods(List<Throwable> errors) { Set<FrameworkMethod> testMethods = new HashSet<FrameworkMethod>(); testMethods.addAll(getTestClass().getAnnotatedMethods(EvoSuiteTest.class)); testMethods.addAll(getTestClass().getAnnotatedMethods(Test.class)); for (FrameworkMethod eachTestMethod : testMethods) { eachTestMethod.validatePublicVoidNoArg(false, errors); } }
/** * Adds to {@code errors} if any method in this class is annotated with {@code annotation}, but: * <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> */ protected void validatePublicVoidNoArgMethods(Class<? extends Annotation> annotation, boolean isStatic, List<Throwable> errors) { List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(annotation); for (FrameworkMethod eachTestMethod : methods) { eachTestMethod.validatePublicVoidNoArg(isStatic, errors); } }
@Mock(reentrant = true) public void validatePublicVoidNoArg(boolean isStatic, List<Throwable> errors) { if (!isStatic && it.getMethod().getParameterTypes().length > 0) { it.validatePublicVoid(false, errors); return; } it.validatePublicVoidNoArg(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); } } }
@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); } } }
@Test public void testValidateTestMethodShouldCheckForPublicVoidNoArgIfNormalTestMethod() { // Given: doReturn(null).when(testMethod).getAnnotation(DataProvider.class); doReturn(null).when(testMethod).getAnnotation(UseDataProvider.class); List<Throwable> errors = new ArrayList<Throwable>(); // When: underTest.validateTestMethod(testMethod, errors); // Then: assertThat(errors).isEmpty(); verify(testMethod).getAnnotation(DataProvider.class); verify(testMethod).getAnnotation(UseDataProvider.class); verify(testMethod).validatePublicVoidNoArg(false, errors); verifyNoMoreInteractions(testMethod); }
@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 sig : signatures(each.getMethod())) { ParametersSuppliedBy annotation = sig.findDeepAnnotation(ParametersSuppliedBy.class); if (annotation != null) { validateParameterSupplier(annotation.value(), errors); } } } }
@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); } } } }