This commit is contained in:
Alexey Kudravtsev
2014-03-17 14:25:54 +04:00
parent 959161ec64
commit 80cbf54205
4 changed files with 27 additions and 20 deletions
@@ -18,6 +18,7 @@ package org.intellij.plugins.relaxNG;
import com.intellij.testFramework.fixtures.CodeInsightTestFixture;
import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory;
import org.jetbrains.annotations.NotNull;
/*
* Created by IntelliJ IDEA.
@@ -26,7 +27,7 @@ import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory;
*/
public abstract class AbstractIndexTest extends HighlightingTestBase {
protected final CodeInsightTestFixture createFixture(IdeaTestFixtureFactory factory) {
protected final CodeInsightTestFixture createFixture(@NotNull IdeaTestFixtureFactory factory) {
return createContentFixture(factory);
}
}
@@ -16,6 +16,7 @@
package org.intellij.plugins.relaxNG;
import com.intellij.codeHighlighting.Pass;
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
import com.intellij.codeInspection.*;
import com.intellij.codeInspection.htmlInspections.RequiredAttributesInspection;
@@ -62,6 +63,7 @@ public abstract class HighlightingTestBase extends UsefulTestCase implements Ide
PlatformTestCase.initPlatformLangPrefix();
}
@Override
protected void setUp() throws Exception {
super.setUp();
final IdeaTestFixtureFactory factory = IdeaTestFixtureFactory.getFixtureFactory();
@@ -80,7 +82,8 @@ public abstract class HighlightingTestBase extends UsefulTestCase implements Ide
myTestFixture.enableInspections(inspectionClasses);
new WriteAction() {
protected void run(Result result) throws Throwable {
@Override
protected void run(@NotNull Result result) throws Throwable {
ResourceUtil.copyFiles(HighlightingTestBase.this);
init();
}
@@ -95,14 +98,11 @@ public abstract class HighlightingTestBase extends UsefulTestCase implements Ide
return PlatformTestUtil.getCommunityPath() + "/xml/relaxng/testData/";
}
protected CodeInsightTestFixture createFixture(IdeaTestFixtureFactory factory) {
protected CodeInsightTestFixture createFixture(@NotNull IdeaTestFixtureFactory factory) {
final TestFixtureBuilder<IdeaProjectTestFixture> builder = factory.createLightFixtureBuilder();
final IdeaProjectTestFixture fixture = builder.getFixture();
final CodeInsightTestFixture testFixture;
testFixture = factory.createCodeInsightFixture(fixture);
return testFixture;
return factory.createCodeInsightFixture(fixture);
}
protected CodeInsightTestFixture createContentFixture(IdeaTestFixtureFactory factory) {
@@ -110,8 +110,7 @@ public abstract class HighlightingTestBase extends UsefulTestCase implements Ide
final EmptyModuleFixtureBuilder moduleBuilder = builder.addModule(EmptyModuleFixtureBuilder.class);
final IdeaProjectTestFixture fixture = builder.getFixture();
final CodeInsightTestFixture testFixture;
testFixture = factory.createCodeInsightFixture(fixture);
final CodeInsightTestFixture testFixture = factory.createCodeInsightFixture(fixture);
final String root = testFixture.getTempDirPath();
moduleBuilder.addContentRoot(root);
@@ -120,20 +119,24 @@ public abstract class HighlightingTestBase extends UsefulTestCase implements Ide
return testFixture;
}
@Override
public CodeInsightTestFixture getFixture() {
return myTestFixture;
}
@Override
public abstract String getTestDataPath();
protected void init() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
ExternalResourceManagerEx.getInstanceEx().addIgnoredResource("urn:test:undefined");
}
});
}
@Override
protected void tearDown() throws Exception {
myTestFixture.tearDown();
super.tearDown();
@@ -173,15 +176,15 @@ public abstract class HighlightingTestBase extends UsefulTestCase implements Ide
final Editor editor = myTestFixture.getEditor();
int[] ignore = externalToolPass == null || externalToolPass ? new int[]{
com.intellij.codeHighlighting.Pass.LINE_MARKERS,
com.intellij.codeHighlighting.Pass.LOCAL_INSPECTIONS,
com.intellij.codeHighlighting.Pass.POPUP_HINTS,
com.intellij.codeHighlighting.Pass.POST_UPDATE_ALL,
com.intellij.codeHighlighting.Pass.UPDATE_ALL,
com.intellij.codeHighlighting.Pass.UPDATE_FOLDING,
com.intellij.codeHighlighting.Pass.UPDATE_OVERRIDEN_MARKERS,
com.intellij.codeHighlighting.Pass.VISIBLE_LINE_MARKERS,
} : new int[]{com.intellij.codeHighlighting.Pass.EXTERNAL_TOOLS};
Pass.LINE_MARKERS,
Pass.LOCAL_INSPECTIONS,
Pass.POPUP_HINTS,
Pass.POST_UPDATE_ALL,
Pass.UPDATE_ALL,
Pass.UPDATE_FOLDING,
Pass.UPDATE_OVERRIDEN_MARKERS,
Pass.VISIBLE_LINE_MARKERS,
} : new int[]{Pass.EXTERNAL_TOOLS};
return CodeInsightTestFixtureImpl.instantiateAndRun(myTestFixture.getFile(), editor, ignore, false);
}
@@ -226,6 +229,7 @@ public abstract class HighlightingTestBase extends UsefulTestCase implements Ide
}
private static class DefaultInspectionProvider implements InspectionToolProvider {
@Override
public Class[] getInspectionClasses() {
return new Class[]{
RngDomInspection.class,
@@ -26,6 +26,7 @@ import com.intellij.refactoring.RefactoringFactory;
import com.intellij.refactoring.RenameRefactoring;
import com.intellij.testFramework.fixtures.CodeInsightTestFixture;
import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory;
import org.jetbrains.annotations.NotNull;
import java.io.File;
@@ -35,7 +36,7 @@ import java.io.File;
*/
public class RncRenameTest extends HighlightingTestBase {
protected CodeInsightTestFixture createFixture(IdeaTestFixtureFactory factory) {
protected CodeInsightTestFixture createFixture(@NotNull IdeaTestFixtureFactory factory) {
return createContentFixture(factory);
}
@@ -18,6 +18,7 @@ package org.intellij.plugins.relaxNG;
import com.intellij.testFramework.fixtures.CodeInsightTestFixture;
import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory;
import org.jetbrains.annotations.NotNull;
/**
* Created by IntelliJ IDEA.
@@ -25,7 +26,7 @@ import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory;
* Date: 22.08.2007
*/
public class RngRenameTest extends HighlightingTestBase {
protected CodeInsightTestFixture createFixture(IdeaTestFixtureFactory factory) {
protected CodeInsightTestFixture createFixture(@NotNull IdeaTestFixtureFactory factory) {
return createContentFixture(factory);
}