mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
java tests: ensure for possibly long test messages details to be included in the visible part (IDEA-165187)
This commit is contained in:
@@ -87,6 +87,19 @@ public class ComparisonFailureData {
|
||||
attrs.put("details", failureIdx > -1 ? trace.substring(failureIdx + failureMessageLength) : trace);
|
||||
|
||||
if (notification != null) {
|
||||
final int expectedIdx = trace.indexOf("expected:<");
|
||||
final String comparisonFailureMessage;
|
||||
if (expectedIdx > 0) {
|
||||
comparisonFailureMessage = trace.substring(0, expectedIdx);
|
||||
}
|
||||
else if (failureIdx > -1) {
|
||||
comparisonFailureMessage = trace.substring(0, failureIdx + failureMessageLength);
|
||||
}
|
||||
else {
|
||||
comparisonFailureMessage = (failureMessageLength > 0 ? failureMessage + "\n" : "") + comparisonFailurePrefix;
|
||||
}
|
||||
attrs.put("message", comparisonFailureMessage);
|
||||
|
||||
final String filePath = notification.getFilePath();
|
||||
if (filePath != null) {
|
||||
attrs.put("expectedFile", filePath);
|
||||
@@ -101,18 +114,6 @@ public class ComparisonFailureData {
|
||||
else {
|
||||
attrs.put("actual", notification.getActual());
|
||||
}
|
||||
final int expectedIdx = trace.indexOf("expected:<");
|
||||
final String comparisonFailureMessage;
|
||||
if (expectedIdx > 0) {
|
||||
comparisonFailureMessage = trace.substring(0, expectedIdx);
|
||||
}
|
||||
else if (failureIdx > -1) {
|
||||
comparisonFailureMessage = trace.substring(0, failureIdx + failureMessageLength);
|
||||
}
|
||||
else {
|
||||
comparisonFailureMessage = (failureMessageLength > 0 ? failureMessage + "\n" : "") + comparisonFailurePrefix;
|
||||
}
|
||||
attrs.put("message", comparisonFailureMessage);
|
||||
}
|
||||
else {
|
||||
Throwable throwableCause = null;
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.opentest4j.ValueWrapper;
|
||||
import java.io.PrintStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -206,7 +206,7 @@ public class JUnit5TestExecutionListener implements TestExecutionListener {
|
||||
long duration,
|
||||
String reason,
|
||||
boolean includeThrowable) {
|
||||
final Map<String, String> attrs = new HashMap<>();
|
||||
final Map<String, String> attrs = new LinkedHashMap<>();
|
||||
attrs.put("name", methodName);
|
||||
attrs.put("id", id);
|
||||
if (duration > 0) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.testng;
|
||||
|
||||
import com.intellij.rt.execution.junit.ComparisonFailureData;
|
||||
import org.testng.internal.IResultListener;
|
||||
import org.testng.xml.XmlTest;
|
||||
|
||||
import java.io.PrintStream;
|
||||
@@ -208,7 +207,7 @@ public class IDEATestNGRemoteListener {
|
||||
}
|
||||
Throwable ex = result.getThrowable();
|
||||
String methodName = getTestMethodNameWithParams(result);
|
||||
final Map<String, String> attrs = new HashMap<String, String>();
|
||||
final Map<String, String> attrs = new LinkedHashMap<String, String>();
|
||||
attrs.put("name", methodName);
|
||||
final String failureMessage = ex.getMessage();
|
||||
ComparisonFailureData notification;
|
||||
|
||||
Reference in New Issue
Block a user