From 50903050ff73070950177c28056fbc9f46957159 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Tue, 26 Aug 2014 14:43:38 +0400 Subject: [PATCH] Configure exception with absolute file path to enable easy patching --- .../jet/checkers/AbstractJetPsiCheckerTest.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/idea/tests/org/jetbrains/jet/checkers/AbstractJetPsiCheckerTest.java b/idea/tests/org/jetbrains/jet/checkers/AbstractJetPsiCheckerTest.java index f9d71cd71fe..9ebe9bd8a04 100644 --- a/idea/tests/org/jetbrains/jet/checkers/AbstractJetPsiCheckerTest.java +++ b/idea/tests/org/jetbrains/jet/checkers/AbstractJetPsiCheckerTest.java @@ -16,6 +16,7 @@ package org.jetbrains.jet.checkers; +import com.intellij.rt.execution.junit.FileComparisonFailure; import com.intellij.spellchecker.inspections.SpellCheckingInspection; import com.intellij.testFramework.LightProjectDescriptor; import org.jetbrains.annotations.NotNull; @@ -23,10 +24,12 @@ import org.jetbrains.jet.plugin.JetLightCodeInsightFixtureTestCase; import org.jetbrains.jet.plugin.JetLightProjectDescriptor; import org.jetbrains.jet.plugin.highlighter.JetPsiChecker; +import java.io.File; + public abstract class AbstractJetPsiCheckerTest extends JetLightCodeInsightFixtureTestCase { public void doTest(@NotNull String filePath) throws Exception { myFixture.configureByFile(filePath); - myFixture.checkHighlighting(true, false, false); + checkHighlighting(true, false, false); } public void doTestWithInfos(@NotNull String filePath) throws Exception { @@ -37,13 +40,22 @@ public abstract class AbstractJetPsiCheckerTest extends JetLightCodeInsightFixtu myFixture.enableInspections(SpellCheckingInspection.class); JetPsiChecker.setNamesHighlightingEnabled(false); - myFixture.checkHighlighting(true, true, false); + checkHighlighting(true, true, false); } finally { JetPsiChecker.setNamesHighlightingEnabled(true); } } + protected long checkHighlighting(boolean checkWarnings, boolean checkInfos, boolean checkWeakWarnings) { + try { + return myFixture.checkHighlighting(checkWarnings, checkInfos, checkWeakWarnings); + } + catch (FileComparisonFailure e) { + throw new FileComparisonFailure(e.getMessage(), e.getExpected(), e.getActual(), new File(e.getFilePath()).getAbsolutePath()); + } + } + @NotNull @Override protected LightProjectDescriptor getProjectDescriptor() {