Skip to content

Commit 6fd44da

Browse files
author
David Saff
committed
Merge pull request #640 from coreyjv/issue162
Issue #162 Implementation
2 parents dce07cd + 2918286 commit 6fd44da

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Diff for: src/main/java/org/junit/runners/BlockJUnit4ClassRunner.java

+11-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import static org.junit.internal.runners.rules.RuleFieldValidator.RULE_VALIDATOR;
55

66
import java.util.List;
7+
import java.util.concurrent.ConcurrentHashMap;
78

89
import org.junit.After;
910
import org.junit.Before;
@@ -48,6 +49,7 @@
4849
* @since 4.5
4950
*/
5051
public class BlockJUnit4ClassRunner extends ParentRunner<FrameworkMethod> {
52+
private final ConcurrentHashMap<FrameworkMethod, Description> fMethodDescriptions = new ConcurrentHashMap<FrameworkMethod, Description>();
5153
/**
5254
* Creates a BlockJUnit4ClassRunner to run {@code klass}
5355
*
@@ -73,8 +75,15 @@ protected void runChild(final FrameworkMethod method, RunNotifier notifier) {
7375

7476
@Override
7577
protected Description describeChild(FrameworkMethod method) {
76-
return Description.createTestDescription(getTestClass().getJavaClass(),
77-
testName(method), method.getAnnotations());
78+
Description description = fMethodDescriptions.get(method);
79+
80+
if (description == null) {
81+
description = Description.createTestDescription(getTestClass().getJavaClass(),
82+
testName(method), method.getAnnotations());
83+
fMethodDescriptions.putIfAbsent(method, description);
84+
}
85+
86+
return description;
7887
}
7988

8089
@Override

0 commit comments

Comments
 (0)