LUCENE-2709: if a test has methods with @ignore, we should print out a notice

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1023022 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2010-10-15 17:12:39 +00:00
parent 2d7ac92ac4
commit 3ee37a7dbb
1 changed files with 9 additions and 0 deletions

View File

@ -47,6 +47,7 @@ import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestWatchman;
@ -779,6 +780,14 @@ public abstract class LuceneTestCase extends Assert {
protected List<FrameworkMethod> computeTestMethods() {
if (testMethods != null)
return testMethods;
// check if the current test's class has methods annotated with @Ignore
final Class<?> clazz = getTestClass().getJavaClass();
for (Method m : clazz.getMethods()) {
Ignore ignored = m.getAnnotation(Ignore.class);
if (ignored != null) {
System.err.println("NOTE: Ignoring test method '" + m.getName() + "' " + ignored.value());
}
}
testMethods = getTestClass().getAnnotatedMethods(Test.class);
for (Method m : getTestClass().getJavaClass().getMethods()) {
final int mod = m.getModifiers();