in src/main/java/org/junit/internal/runners/MethodValidator.java [69:96]
private void validateTestMethods(Class<? extends Annotation> annotation,
boolean isStatic) {
List<Method> methods = testClass.getAnnotatedMethods(annotation);
for (Method each : methods) {
if (Modifier.isStatic(each.getModifiers()) != isStatic) {
String state = isStatic ? "should" : "should not";
errors.add(new Exception("Method " + each.getName() + "() "
+ state + " be static"));
}
if (!Modifier.isPublic(each.getDeclaringClass().getModifiers())) {
errors.add(new Exception("Class " + each.getDeclaringClass().getName()
+ " should be public"));
}
if (!Modifier.isPublic(each.getModifiers())) {
errors.add(new Exception("Method " + each.getName()
+ " should be public"));
}
if (each.getReturnType() != Void.TYPE) {
errors.add(new Exception("Method " + each.getName()
+ "should have a return type of void"));
}
if (each.getParameterTypes().length != 0) {
errors.add(new Exception("Method " + each.getName()
+ " should have no parameters"));
}
}
}