From a00c1f4e7f8b6fccf02ac992a49f6599ca922ce5 Mon Sep 17 00:00:00 2001 From: Maxim Kropotov Date: Thu, 12 Oct 2017 19:16:08 +0300 Subject: [PATCH] PlatformTestUtil: throw FileComparisonFailure to make testdata editable --- .../src/com/intellij/testFramework/PlatformTestUtil.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java index 1a0757bf07de..0aee8b3ae1f4 100644 --- a/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java +++ b/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java @@ -60,6 +60,7 @@ import com.intellij.openapi.vfs.ex.temp.TempFileSystem; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiRecursiveElementWalkingVisitor; import com.intellij.psi.PsiReference; +import com.intellij.rt.execution.junit.FileComparisonFailure; import com.intellij.util.*; import com.intellij.util.concurrency.AppExecutorUtil; import com.intellij.util.concurrency.AppScheduledExecutorService; @@ -906,8 +907,8 @@ public class PlatformTestUtil { ? null : LoadTextUtil.getTextByBinaryPresentation(fileAfter.contentsToByteArray(false), fileAfter).toString(); - if (textA != null && textB != null) { - Assert.assertEquals(fileAfter.getPath(), textA, textB); + if (textA != null && textB != null && !StringUtil.equals(textA, textB)) { + throw new FileComparisonFailure("Text mismatch in file " + fileBefore.getName(), textA, textB, fileAfter.getPath()); } else { Assert.assertArrayEquals(fileAfter.getPath(), fileAfter.contentsToByteArray(), fileBefore.contentsToByteArray());