Skip to content

Commit

Permalink
Don't verify the visibility of a method's declaring class.
Browse files Browse the repository at this point in the history
I would not expect FrameworkMethod.validatePublicVoid(...) to test
visibility of the declaring class. Since the last commit the runner
itself verifies that a test class is public. Hence we can safely remove
this validation from FrameworkMethod.

This fixes #749 (JUnit cannot be build with JDK 8), too.
  • Loading branch information
stefanbirkner committed Apr 22, 2014
1 parent 1d97da7 commit 88f7a12
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 19 deletions.
4 changes: 0 additions & 4 deletions src/main/java/org/junit/runners/model/FrameworkMethod.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import java.util.List;

Expand Down Expand Up @@ -91,9 +90,6 @@ public void validatePublicVoid(boolean isStatic, List<Throwable> errors) {
String state = isStatic ? "should" : "should not";
errors.add(new Exception("Method " + fMethod.getName() + "() " + state + " be static"));
}
if (!Modifier.isPublic(getDeclaringClass().getModifiers())) {
errors.add(new Exception("Class " + getDeclaringClass().getName() + " should be public"));
}
if (!isPublic()) {
errors.add(new Exception("Method " + fMethod.getName() + "() should be public"));
}
Expand Down
2 changes: 0 additions & 2 deletions src/test/java/org/junit/tests/AllTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@
import org.junit.tests.running.methods.TimeoutTest;
import org.junit.tests.validation.BadlyFormedClassesTest;
import org.junit.tests.validation.FailedConstructionTest;
import org.junit.tests.validation.InaccessibleBaseClassTest;
import org.junit.tests.validation.ValidationTest;
import org.junit.validator.PublicClassValidatorTest;

Expand Down Expand Up @@ -143,7 +142,6 @@
JUnit38ClassRunnerTest.class,
SystemExitTest.class,
JUnitCoreReturnsCorrectExitCodeTest.class,
InaccessibleBaseClassTest.class,
SuiteMethodTest.class,
BadlyFormedClassesTest.class,
IgnoreClassTest.class,
Expand Down

This file was deleted.

0 comments on commit 88f7a12

Please sign in to comment.