Skip to content

Commit fbbae1e

Browse files
committed
Avoid unnecessary call to ParentRunner.createTestClass() for tests not annotated with @RunWith.
1 parent aec7f5a commit fbbae1e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package org.junit.internal.builders;
22

33
import org.junit.runner.Runner;
4-
import org.junit.runners.BlockJUnit4ClassRunner;
4+
import org.junit.runners.JUnit4;
55
import org.junit.runners.model.RunnerBuilder;
66

77
public class JUnit4Builder extends RunnerBuilder {
88
@Override
99
public Runner runnerForClass(Class<?> testClass) throws Throwable {
10-
return new BlockJUnit4ClassRunner(testClass);
10+
return new JUnit4(testClass);
1111
}
12-
}
12+
}

src/main/java/org/junit/runners/JUnit4.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.junit.runners;
22

33
import org.junit.runners.model.InitializationError;
4+
import org.junit.runners.model.TestClass;
45

56
/**
67
* Aliases the current default JUnit 4 class runner, for future-proofing. If
@@ -19,6 +20,6 @@ public final class JUnit4 extends BlockJUnit4ClassRunner {
1920
* Constructs a new instance of the default runner
2021
*/
2122
public JUnit4(Class<?> klass) throws InitializationError {
22-
super(klass);
23+
super(new TestClass(klass));
2324
}
2425
}

0 commit comments

Comments
 (0)