Base class for jet light fixture to execute runPostStartupActivities() in more fixture tests
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2010-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.plugin;
|
||||
|
||||
import com.intellij.ide.startup.impl.StartupManagerImpl;
|
||||
import com.intellij.openapi.startup.StartupManager;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
|
||||
public abstract class JetLightCodeInsightFixtureTestCase extends LightCodeInsightFixtureTestCase {
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
((StartupManagerImpl) StartupManager.getInstance(getProject())).runPostStartupActivities();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
protected String fileName() {
|
||||
return getTestName(false) + ".kt";
|
||||
}
|
||||
}
|
||||
+3
-4
@@ -22,13 +22,12 @@ import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.testFramework.ExpectedHighlightingData;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.jet.plugin.JetLightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OverrideImplementLineMarkerTest extends LightCodeInsightFixtureTestCase {
|
||||
|
||||
public class OverrideImplementLineMarkerTest extends JetLightCodeInsightFixtureTestCase {
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return PluginTestCaseBase.TEST_DATA_PROJECT_RELATIVE + "/codeInsight/lineMarker";
|
||||
@@ -52,7 +51,7 @@ public class OverrideImplementLineMarkerTest extends LightCodeInsightFixtureTest
|
||||
|
||||
private void doTest() {
|
||||
try {
|
||||
myFixture.configureByFile(getTestName(false) + ".kt");
|
||||
myFixture.configureByFile(fileName());
|
||||
Project project = myFixture.getProject();
|
||||
Document document = myFixture.getEditor().getDocument();
|
||||
|
||||
|
||||
@@ -20,16 +20,16 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.asJava.KotlinLightClass;
|
||||
import org.jetbrains.jet.asJava.LightClassUtil;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
||||
import org.jetbrains.jet.plugin.JetLightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.jet.plugin.JetLightProjectDescriptor;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
|
||||
public class JetJavaFacadeTest extends LightCodeInsightFixtureTestCase {
|
||||
public class JetJavaFacadeTest extends JetLightCodeInsightFixtureTestCase {
|
||||
@NotNull
|
||||
@Override
|
||||
protected LightProjectDescriptor getProjectDescriptor() {
|
||||
@@ -39,7 +39,11 @@ public class JetJavaFacadeTest extends LightCodeInsightFixtureTestCase {
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
myFixture.setTestDataPath(PluginTestCaseBase.getTestDataPathBase() + "/javaFacade");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PluginTestCaseBase.getTestDataPathBase() + "/javaFacade";
|
||||
}
|
||||
|
||||
public void testDoNotWrapFunFromLocalClass() {
|
||||
@@ -135,7 +139,7 @@ public class JetJavaFacadeTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testEa38770() {
|
||||
myFixture.configureByFile(getTestName(true) + ".kt");
|
||||
myFixture.configureByFile(fileName());
|
||||
|
||||
PsiReference reference = myFixture.getFile().findReferenceAt(myFixture.getCaretOffset());
|
||||
assertNotNull(reference);
|
||||
@@ -148,7 +152,7 @@ public class JetJavaFacadeTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testInnerClass() throws Exception {
|
||||
myFixture.configureByFile(getTestName(true) + ".kt");
|
||||
myFixture.configureByFile(fileName());
|
||||
|
||||
JavaPsiFacade facade = myFixture.getJavaFacade();
|
||||
PsiClass mirrorClass = facade.findClass("foo.Outer.Inner", GlobalSearchScope.allScope(getProject()));
|
||||
@@ -160,7 +164,7 @@ public class JetJavaFacadeTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testClassObject() throws Exception {
|
||||
myFixture.configureByFile(getTestName(true) + ".kt");
|
||||
myFixture.configureByFile(fileName());
|
||||
|
||||
JavaPsiFacade facade = myFixture.getJavaFacade();
|
||||
PsiClass theClass = facade.findClass("foo.TheClass", GlobalSearchScope.allScope(getProject()));
|
||||
@@ -188,7 +192,7 @@ public class JetJavaFacadeTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testLightClassIsNotCreatedForBuiltins() throws Exception {
|
||||
myFixture.configureByFile(getTestName(true) + ".kt");
|
||||
myFixture.configureByFile(fileName());
|
||||
|
||||
PsiReference reference = myFixture.getFile().findReferenceAt(myFixture.getCaretOffset());
|
||||
assert reference != null;
|
||||
@@ -242,7 +246,7 @@ public class JetJavaFacadeTest extends LightCodeInsightFixtureTestCase {
|
||||
|
||||
@NotNull
|
||||
private <T extends JetElement> T getPreparedElement(Class<T> elementClass) {
|
||||
myFixture.configureByFile(getTestName(true) + ".kt");
|
||||
myFixture.configureByFile(fileName());
|
||||
|
||||
int offset = myFixture.getEditor().getCaretModel().getOffset();
|
||||
PsiElement elementAt = myFixture.getFile().findElementAt(offset);
|
||||
@@ -270,7 +274,7 @@ public class JetJavaFacadeTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
private void doTestWrapClass() {
|
||||
myFixture.configureByFile(getTestName(true) + ".kt");
|
||||
myFixture.configureByFile(fileName());
|
||||
|
||||
int offset = myFixture.getEditor().getCaretModel().getOffset();
|
||||
PsiElement elementAt = myFixture.getFile().findElementAt(offset);
|
||||
@@ -289,4 +293,9 @@ public class JetJavaFacadeTest extends LightCodeInsightFixtureTestCase {
|
||||
// No exception/error should happen here
|
||||
lightClass.getDelegate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String fileName() {
|
||||
return getTestName(true) + ".kt";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,40 +16,12 @@
|
||||
|
||||
package org.jetbrains.jet.plugin.navigation;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.module.StdModuleTypes;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.ContentEntry;
|
||||
import com.intellij.openapi.roots.ModifiableRootModel;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.plugin.JetLightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class JetGotoSymbolTest extends LightCodeInsightFixtureTestCase {
|
||||
@NotNull
|
||||
@Override
|
||||
protected LightProjectDescriptor getProjectDescriptor() {
|
||||
return new LightProjectDescriptor() {
|
||||
@Override
|
||||
public ModuleType getModuleType() {
|
||||
return StdModuleTypes.JAVA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sdk getSdk() {
|
||||
return PluginTestCaseBase.jdkFromIdeaHome();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public class JetGotoSymbolTest extends JetLightCodeInsightFixtureTestCase {
|
||||
public void testProperties() {
|
||||
doTest();
|
||||
}
|
||||
@@ -64,9 +36,12 @@ public class JetGotoSymbolTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
protected void doTest() {
|
||||
String fileName = getTestName(true) + ".kt";
|
||||
myFixture.configureByFile(fileName);
|
||||
|
||||
myFixture.configureByFile(fileName());
|
||||
NavigationTestUtils.assertGotoSymbol(getProject(), myFixture.getEditor());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String fileName() {
|
||||
return getTestName(true) + ".kt";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user