summaryrefslogtreecommitdiff
path: root/plugins/structuralsearch/testSource/com/intellij/structuralsearch/SSRCodeInsightTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/structuralsearch/testSource/com/intellij/structuralsearch/SSRCodeInsightTest.java')
-rw-r--r--plugins/structuralsearch/testSource/com/intellij/structuralsearch/SSRCodeInsightTest.java75
1 files changed, 0 insertions, 75 deletions
diff --git a/plugins/structuralsearch/testSource/com/intellij/structuralsearch/SSRCodeInsightTest.java b/plugins/structuralsearch/testSource/com/intellij/structuralsearch/SSRCodeInsightTest.java
deleted file mode 100644
index 5031f821c581..000000000000
--- a/plugins/structuralsearch/testSource/com/intellij/structuralsearch/SSRCodeInsightTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.intellij.structuralsearch;
-
-import com.intellij.openapi.application.PluginPathManager;
-import com.intellij.structuralsearch.inspection.highlightTemplate.SSBasedInspection;
-import com.intellij.structuralsearch.plugin.ui.Configuration;
-import com.intellij.structuralsearch.plugin.ui.SearchConfiguration;
-import com.intellij.testFramework.IdeaTestCase;
-import com.intellij.testFramework.UsefulTestCase;
-import com.intellij.testFramework.fixtures.*;
-import com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl;
-
-import java.util.Collections;
-
-public class SSRCodeInsightTest extends UsefulTestCase {
- protected CodeInsightTestFixture myFixture;
- private SSBasedInspection myInspection;
-
- public SSRCodeInsightTest() {
- IdeaTestCase.initPlatformPrefix();
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- IdeaTestFixtureFactory factory = IdeaTestFixtureFactory.getFixtureFactory();
- TestFixtureBuilder<IdeaProjectTestFixture> fixtureBuilder = factory.createLightFixtureBuilder(new DefaultLightProjectDescriptor());
- final IdeaProjectTestFixture fixture = fixtureBuilder.getFixture();
- myFixture = IdeaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(fixture,
- new LightTempDirTestFixtureImpl(true));
- myInspection = new SSBasedInspection();
- myFixture.enableInspections(myInspection);
- myFixture.setUp();
- myFixture.setTestDataPath(getTestDataPath());
- }
-
- @Override
- protected void tearDown() throws Exception {
- myFixture.tearDown();
- myFixture = null;
- myInspection = null;
- super.tearDown();
- }
-
- public void testExpressionStatement() {
- doTest("File.createTempFile($p1$, $p2$)", "Forbid File.createTempFile");
- }
-
- public void testTwoStatementPattern() {
- doTest("$field$ = $something$;\n" +
- "if ($field$ == null) {\n" +
- " throw new $Exception$($msg$);\n" +
- "}",
- "silly null check");
- }
-
- private void doTest(final String searchPattern, final String patternName) {
- final SearchConfiguration configuration = new SearchConfiguration();
- //display name
- configuration.setName(patternName);
-
- //search pattern
- final MatchOptions options = new MatchOptions();
- options.setSearchPattern(searchPattern);
- configuration.setMatchOptions(options);
-
- myInspection.setConfigurations(Collections.<Configuration>singletonList(configuration), myFixture.getProject());
- myInspection.projectOpened(myFixture.getProject());
-
- myFixture.testHighlighting(true, false, false, getTestName(false) + ".java");
- }
-
- protected String getTestDataPath() {
- return PluginPathManager.getPluginHomePath("structuralsearch") + "/testData/ssBased";
- }
-}