mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
junit: start ignored tests recursively (IDEA-98867)
This commit is contained in:
@@ -120,8 +120,8 @@ public class JUnit4TestRunnerUtil {
|
||||
if (clazzAnnotation == null) { //do not override external runners
|
||||
try {
|
||||
final Method method = clazz.getMethod(methodName, null);
|
||||
if (method != null && notForked && method.getAnnotation(Ignore.class) != null) { //override ignored case only
|
||||
final Request classRequest = createIgnoreIgnoredClassRequest(clazz);
|
||||
if (method != null && notForked && (method.getAnnotation(Ignore.class) != null || clazz.getAnnotation(Ignore.class) != null)) { //override ignored case only
|
||||
final Request classRequest = createIgnoreIgnoredClassRequest(clazz, true);
|
||||
final Filter ignoredTestFilter = Filter.matchMethodDescription(Description.createTestDescription(clazz, methodName));
|
||||
return classRequest.filterWith(new Filter() {
|
||||
public boolean shouldRun(Description description) {
|
||||
@@ -167,7 +167,7 @@ public class JUnit4TestRunnerUtil {
|
||||
final Class clazz = (Class)result.get(0);
|
||||
try {
|
||||
if (clazz.getAnnotation(Ignore.class) != null) { //override ignored case only
|
||||
return createIgnoreIgnoredClassRequest(clazz);
|
||||
return createIgnoreIgnoredClassRequest(clazz, false);
|
||||
}
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
@@ -178,12 +178,12 @@ public class JUnit4TestRunnerUtil {
|
||||
return Request.classes(getArrayOfClasses(result));
|
||||
}
|
||||
|
||||
private static Request createIgnoreIgnoredClassRequest(final Class clazz) throws ClassNotFoundException {
|
||||
private static Request createIgnoreIgnoredClassRequest(final Class clazz, final boolean recursively) throws ClassNotFoundException {
|
||||
Class.forName("org.junit.runners.BlockJUnit4ClassRunner"); //ignore IgnoreIgnored for junit4.4 and <
|
||||
return new ClassRequest(clazz) {
|
||||
public Runner getRunner() {
|
||||
try {
|
||||
return new IgnoreIgnoredTestJUnit4ClassRunner(clazz);
|
||||
return new IgnoreIgnoredTestJUnit4ClassRunner(clazz, recursively);
|
||||
}
|
||||
catch (Exception ignored) {
|
||||
//return super runner
|
||||
@@ -245,11 +245,18 @@ public class JUnit4TestRunnerUtil {
|
||||
|
||||
|
||||
private static class IgnoreIgnoredTestJUnit4ClassRunner extends BlockJUnit4ClassRunner {
|
||||
public IgnoreIgnoredTestJUnit4ClassRunner(Class clazz) throws Exception {
|
||||
private final boolean myRecursively;
|
||||
|
||||
public IgnoreIgnoredTestJUnit4ClassRunner(Class clazz, boolean recursively) throws Exception {
|
||||
super(clazz);
|
||||
myRecursively = recursively;
|
||||
}
|
||||
|
||||
protected void runChild(FrameworkMethod method, RunNotifier notifier) {
|
||||
if (!myRecursively){
|
||||
super.runChild(method, notifier);
|
||||
return;
|
||||
}
|
||||
final Description description = describeChild(method);
|
||||
final EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description);
|
||||
eachNotifier.fireTestStarted();
|
||||
|
||||
Reference in New Issue
Block a user