IDEA-147482 Notification running tests via gradle contains incorrect results

This commit is contained in:
Vladislav.Soroka
2015-11-09 14:46:57 +03:00
parent 4424c6b82a
commit 050a823fbb
@@ -23,6 +23,7 @@ import com.intellij.util.ObjectUtils;
import org.jetbrains.plugins.gradle.execution.test.runner.GradleTestsExecutionConsole;
import org.jetbrains.plugins.gradle.util.XmlXpathHelper;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -54,14 +55,14 @@ public class AfterTestEvent extends AbstractTestEvent {
catch (NumberFormatException ignored) {
}
final CompositeRunnable runInEdt = new CompositeRunnable();
final TestEventResult result = getTestEventResultType(eventXml);
switch (result) {
case SUCCESS:
addToInvokeLater(new Runnable() {
runInEdt.add(new Runnable() {
@Override
public void run() {
testProxy.setFinished();
getResultsViewer().onTestFinished(testProxy);
}
});
break;
@@ -102,7 +103,7 @@ public class AfterTestEvent extends AbstractTestEvent {
}
final Couple<String> finalComparisonPair = comparisonPair;
addToInvokeLater(new Runnable() {
runInEdt.add(new Runnable() {
@Override
public void run() {
if (finalComparisonPair != null) {
@@ -111,9 +112,10 @@ public class AfterTestEvent extends AbstractTestEvent {
else {
testProxy.setTestFailed(exceptionMsg, stackTrace, "error".equals(failureType));
}
}});
}
});
}
addToInvokeLater(new Runnable() {
runInEdt.add(new Runnable() {
@Override
public void run() {
getResultsViewer().onTestFailed(testProxy);
@@ -121,10 +123,10 @@ public class AfterTestEvent extends AbstractTestEvent {
});
break;
case SKIPPED:
testProxy.setTestIgnored(null, null);
addToInvokeLater(new Runnable() {
runInEdt.add(new Runnable() {
@Override
public void run() {
testProxy.setTestIgnored(null, null);
getResultsViewer().onTestIgnored(testProxy);
}
});
@@ -132,6 +134,15 @@ public class AfterTestEvent extends AbstractTestEvent {
case UNKNOWN_RESULT:
break;
}
runInEdt.add(new Runnable() {
@Override
public void run() {
getResultsViewer().onTestFinished(testProxy);
}
});
addToInvokeLater(runInEdt);
}
private static Couple<String> parseComparisonMessage(String message, final String regex) {
@@ -141,4 +152,13 @@ public class AfterTestEvent extends AbstractTestEvent {
}
return null;
}
private static class CompositeRunnable extends ArrayList<Runnable> implements Runnable {
@Override
public void run() {
for (Runnable runnable : this) {
runnable.run();
}
}
}
}