mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
tests ui: pass current test name so comparison failure is able to present it in the diff title (IDEA-206042)
This commit is contained in:
@@ -528,6 +528,11 @@ public class SMTestProxy extends AbstractTestProxy {
|
||||
setStacktraceIfNotSet(stackTrace);
|
||||
myErrorMessage = localizedMessage;
|
||||
final TestComparisionFailedState comparisionFailedState = new TestComparisionFailedState(localizedMessage, stackTrace, actualText, expectedText, expectedFilePath, actualFilePath);
|
||||
DiffHyperlink hyperlink = comparisionFailedState.getHyperlink();
|
||||
if (hyperlink != null) {
|
||||
hyperlink.setTestProxyName(getName());
|
||||
}
|
||||
|
||||
if (myState instanceof CompoundTestFailedState) {
|
||||
((CompoundTestFailedState)myState).addFailure(comparisionFailedState);
|
||||
}
|
||||
|
||||
@@ -171,6 +171,16 @@ public abstract class AbstractTestProxy extends CompositePrintable {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DiffHyperlink createHyperlink(String expected,
|
||||
String actual,
|
||||
String filePath,
|
||||
final String actualFilePath, final boolean printOneLine) {
|
||||
DiffHyperlink hyperlink = super.createHyperlink(expected, actual, filePath, actualFilePath, printOneLine);
|
||||
hyperlink.setTestProxyName(getName());
|
||||
return hyperlink;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getLocationUrl() {
|
||||
return null;
|
||||
|
||||
+8
-2
@@ -344,8 +344,7 @@ public class CompositePrintable extends UserDataHolderBase implements Printable,
|
||||
final String firstToken = IOUtil.readString(reader);
|
||||
if (firstToken == null) break;
|
||||
if (firstToken.equals(HYPERLINK)) {
|
||||
new DiffHyperlink(IOUtil.readString(reader), IOUtil.readString(reader), IOUtil.readString(reader), false)
|
||||
.printOn(printer);
|
||||
createHyperlink(IOUtil.readString(reader), IOUtil.readString(reader), IOUtil.readString(reader), null, false).printOn(printer);
|
||||
}
|
||||
else {
|
||||
ConsoleViewContentType contentType = contentTypeByNameMap.getOrDefault(firstToken, ConsoleViewContentType.NORMAL_OUTPUT);
|
||||
@@ -387,6 +386,13 @@ public class CompositePrintable extends UserDataHolderBase implements Printable,
|
||||
}
|
||||
}
|
||||
|
||||
protected DiffHyperlink createHyperlink(final String expected,
|
||||
final String actual,
|
||||
final String filePath,
|
||||
final String actualFilePath, final boolean printOneLine) {
|
||||
return new DiffHyperlink(expected, actual, filePath, actualFilePath, printOneLine);
|
||||
}
|
||||
|
||||
private void printOutputFile(List<Printable> currentPrintables) {
|
||||
if (myOutputFile != null && new File(myOutputFile).isFile()) {
|
||||
try (PrintStream printStream = new PrintStream(new FileOutputStream(new File(myOutputFile), true))) {
|
||||
|
||||
+6
-1
@@ -43,6 +43,7 @@ public class DiffHyperlink implements Printable {
|
||||
protected final String myActualFilePath;
|
||||
private final boolean myPrintOneLine;
|
||||
private final HyperlinkInfo myDiffHyperlink = new DiffHyperlinkInfo();
|
||||
private String myTestProxyName;
|
||||
|
||||
|
||||
public DiffHyperlink(final String expected, final String actual, final String filePath) {
|
||||
@@ -68,12 +69,16 @@ public class DiffHyperlink implements Printable {
|
||||
myPrintOneLine = printOneLine;
|
||||
}
|
||||
|
||||
public void setTestProxyName(String name) {
|
||||
myTestProxyName = name;
|
||||
}
|
||||
|
||||
private static String normalizeSeparators(String filePath) {
|
||||
return filePath == null ? null : filePath.replace(File.separatorChar, '/');
|
||||
}
|
||||
|
||||
protected String getTitle() {
|
||||
return ExecutionBundle.message("strings.equal.failed.dialog.title");
|
||||
return ExecutionBundle.message("strings.equal.failed.dialog.title") + (myTestProxyName != null ? " (" + myTestProxyName + ")" : "");
|
||||
}
|
||||
|
||||
public String getDiffTitle() {
|
||||
|
||||
Reference in New Issue
Block a user