diff --git a/java/testFramework/src/com/intellij/testFramework/InspectionTestCase.java b/java/testFramework/src/com/intellij/testFramework/InspectionTestCase.java index 18bba87c8617..5ad8b8655f5b 100644 --- a/java/testFramework/src/com/intellij/testFramework/InspectionTestCase.java +++ b/java/testFramework/src/com/intellij/testFramework/InspectionTestCase.java @@ -49,6 +49,7 @@ import org.jetbrains.annotations.NotNull; import java.io.File; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -119,7 +120,7 @@ public abstract class InspectionTestCase extends PsiTestCase { final String testDir = getTestDataPath() + "/" + folderName; GlobalInspectionContextImpl context = runTool(testDir, jdkName, runDeadCodeFirst, toolWrapper, additional); - InspectionTestUtil.compareToolResults(context, toolWrapper, checkRange, testDir); + InspectionTestUtil.compareToolResults(context, checkRange, testDir, ContainerUtil.append(Collections.singletonList(toolWrapper), additional)); } protected void runTool(@NonNls @NotNull String testDir, @NonNls final String jdkName, @NotNull InspectionToolWrapper tool) { diff --git a/platform/testFramework/src/com/intellij/testFramework/InspectionTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/InspectionTestUtil.java index 98773afb443b..cb2b23b104b0 100644 --- a/platform/testFramework/src/com/intellij/testFramework/InspectionTestUtil.java +++ b/platform/testFramework/src/com/intellij/testFramework/InspectionTestUtil.java @@ -32,6 +32,7 @@ import com.intellij.util.ui.UIUtil; import org.jdom.Document; import org.jdom.Element; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.TestOnly; import org.junit.Assert; import java.io.CharArrayReader; @@ -50,7 +51,7 @@ public class InspectionTestUtil { Element[] expectedArray = expectedProblems.toArray(new Element[expectedProblems.size()]); boolean failed = false; -expected: + expected: for (Element expectedProblem : expectedArray) { Element[] reportedArrayed = reportedProblems.toArray(new Element[reportedProblems.size()]); for (Element reportedProblem : reportedArrayed) { @@ -62,13 +63,13 @@ expected: } Document missing = new Document(expectedProblem.clone()); - System.out.println("The following haven't been reported as expected: " + new String(JDOMUtil.printDocument(missing, "\n"))); + System.out.println("The following haven't been reported as expected: " + JDOMUtil.writeDocument(missing, "\n")); failed = true; } for (Element reportedProblem : reportedProblems) { Document extra = new Document(reportedProblem.clone()); - System.out.println("The following has been unexpectedly reported: " + new String(JDOMUtil.printDocument(extra, "\n"))); + System.out.println("The following has been unexpectedly reported: " + JDOMUtil.writeDocument(extra, "\n")); failed = true; } @@ -136,23 +137,32 @@ expected: public static void compareToolResults(@NotNull GlobalInspectionContextImpl context, @NotNull InspectionToolWrapper toolWrapper, boolean checkRange, - String testDir) { + @NotNull String testDir) { + compareToolResults(context, checkRange, testDir, Collections.singletonList(toolWrapper)); + } + + static void compareToolResults(@NotNull GlobalInspectionContextImpl context, + boolean checkRange, + @NotNull String testDir, + @NotNull Collection toolWrappers) { final Element root = new Element("problems"); - final Document doc = new Document(root); - InspectionToolPresentation presentation = context.getPresentation(toolWrapper); - presentation.updateContent(); //e.g. dead code need check for reachables - presentation.exportResults(root, x -> false, x -> false); + for (InspectionToolWrapper toolWrapper : toolWrappers) { + InspectionToolPresentation presentation = context.getPresentation(toolWrapper); + presentation.updateContent(); //e.g. dead code need check for reachables + presentation.exportResults(root, x -> false, x -> false); + } - File file = new File(testDir + "/expected.xml"); try { - compareWithExpected(JDOMUtil.loadDocument(file), doc, checkRange); + File file = new File(testDir + "/expected.xml"); + compareWithExpected(JDOMUtil.loadDocument(file), new Document(root), checkRange); } catch (Exception e) { throw new RuntimeException(e); } } + @TestOnly public static void runTool(@NotNull InspectionToolWrapper toolWrapper, @NotNull final AnalysisScope scope, @NotNull final GlobalInspectionContextForTests globalContext) { diff --git a/plugins/java-i18n/java-i18n.iml b/plugins/java-i18n/java-i18n.iml index 6cc212d8a002..f15c227ff827 100644 --- a/plugins/java-i18n/java-i18n.iml +++ b/plugins/java-i18n/java-i18n.iml @@ -22,5 +22,6 @@ + \ No newline at end of file diff --git a/plugins/java-i18n/testSrc/com/intellij/codeInspection/i18n/I18NInspectionTest.java b/plugins/java-i18n/testSrc/com/intellij/codeInspection/i18n/I18NInspectionTest.java index dd0a1ac39fa1..d3ba5134c57c 100644 --- a/plugins/java-i18n/testSrc/com/intellij/codeInspection/i18n/I18NInspectionTest.java +++ b/plugins/java-i18n/testSrc/com/intellij/codeInspection/i18n/I18NInspectionTest.java @@ -3,11 +3,14 @@ */ package com.intellij.codeInspection.i18n; +import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; import com.intellij.openapi.application.PluginPathManager; import com.intellij.openapi.roots.LanguageLevelProjectExtension; import com.intellij.pom.java.LanguageLevel; import com.intellij.psi.JavaPsiFacade; import com.intellij.testFramework.InspectionTestCase; +import com.intellij.testFramework.InspectionsKt; +import com.intellij.uiDesigner.i18n.I18nFormInspection; /** * @author lesya @@ -40,7 +43,12 @@ public class I18NInspectionTest extends InspectionTestCase { } } - public void testFormTabbedPaneTitle() throws Exception { doTest(); } + public void testFormTabbedPaneTitle() throws Exception { + LocalInspectionToolWrapper wrapper = new LocalInspectionToolWrapper(new I18nFormInspection()); + InspectionsKt.enableInspectionTool(getProject(), wrapper, getTestRootDisposable()); + doTest("i18n/" + getTestName(true), new LocalInspectionToolWrapper(new I18nInspection()), "java 1.4", false, false, + wrapper); + } public void testVarargNonNlsParameter() throws Exception { doTest(); } public void testInitializerInAnonymousClass() throws Exception{ doTest(); } public void testNonNlsArray() throws Exception{ doTest(); } diff --git a/plugins/ui-designer/src/META-INF/plugin.xml b/plugins/ui-designer/src/META-INF/plugin.xml index b9067a72b01e..552c196a10ac 100644 --- a/plugins/ui-designer/src/META-INF/plugin.xml +++ b/plugins/ui-designer/src/META-INF/plugin.xml @@ -32,10 +32,6 @@ - - - - @@ -46,22 +42,22 @@ - - - - - -