You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2012/03/09 17:58:02 UTC
svn commit: r1298925 -
/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/StoreClassNameRule.java
Author: dweiss
Date: Fri Mar 9 16:58:01 2012
New Revision: 1298925
URL: http://svn.apache.org/viewvc?rev=1298925&view=rev
Log:
Don't load the class before evaluation of a subrule, invoke lazily.
Modified:
lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/StoreClassNameRule.java
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/StoreClassNameRule.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/StoreClassNameRule.java?rev=1298925&r1=1298924&r2=1298925&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/StoreClassNameRule.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/StoreClassNameRule.java Fri Mar 9 16:58:01 2012
@@ -5,7 +5,7 @@ import org.junit.runner.Description;
import org.junit.runners.model.Statement;
public class StoreClassNameRule implements TestRule {
- private volatile Class<?> testClass;
+ private volatile Description description;
@Override
public Statement apply(final Statement s, final Description d) {
@@ -17,10 +17,10 @@ public class StoreClassNameRule implemen
@Override
public void evaluate() throws Throwable {
try {
- testClass = d.getTestClass();
+ description = d;
s.evaluate();
} finally {
- testClass = null;
+ description = null;
}
}
};
@@ -30,10 +30,10 @@ public class StoreClassNameRule implemen
* Returns the test class currently executing in this rule.
*/
public Class<?> getTestClass() {
- Class<?> clz = testClass;
- if (clz == null) {
+ Description localDescription = description;
+ if (localDescription == null) {
throw new RuntimeException("The rule is not currently executing.");
}
- return clz;
+ return localDescription.getTestClass();
}
}