autodetect platform prefix in all tests; mark the manual initialization methods as deprecated; remove some of the usages

This commit is contained in:
Dmitry Jemerov
2015-05-13 13:54:14 +02:00
parent cac132598b
commit 6061bb407f
11 changed files with 28 additions and 43 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -62,6 +62,9 @@ public abstract class IdeaTestCase extends PlatformTestCase {
return StdModuleTypes.JAVA;
}
/**
* @deprecated calling this method is no longer necessary
*/
public static void initPlatformPrefix() {
initPlatformPrefix("com.intellij.idea.IdeaUltimateApplication", "Idea");
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -26,11 +26,6 @@ import com.intellij.psi.impl.JavaPsiFacadeEx;
* A TestCase for single PsiFile being opened in Editor conversion. See configureXXX and checkResultXXX method docs.
*/
public abstract class LightCodeInsightTestCase extends LightPlatformCodeInsightTestCase {
@SuppressWarnings("JUnitTestCaseWithNonTrivialConstructors")
protected LightCodeInsightTestCase() {
IdeaTestCase.initPlatformPrefix();
}
public static JavaPsiFacadeEx getJavaFacade() {
return JavaPsiFacadeEx.getInstanceEx(ourProject);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -18,7 +18,6 @@ package com.intellij.testFramework;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.module.StdModuleTypes;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
import com.intellij.psi.impl.JavaPsiFacadeEx;
/**
@@ -31,11 +30,6 @@ import com.intellij.psi.impl.JavaPsiFacadeEx;
* so it contains classes that is really needed in order to speed up tests startup.
*/
public abstract class LightIdeaTestCase extends LightPlatformTestCase {
@SuppressWarnings({"JUnitTestCaseWithNonTrivialConstructors"})
public LightIdeaTestCase() {
IdeaTestCase.initPlatformPrefix();
}
public static JavaPsiFacadeEx getJavaFacade() {
return JavaPsiFacadeEx.getInstanceEx(ourProject);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -80,7 +80,6 @@ public abstract class LightCodeInsightFixtureTestCase extends UsefulTestCase{
@SuppressWarnings("JUnitTestCaseWithNonTrivialConstructors")
protected LightCodeInsightFixtureTestCase() {
IdeaTestCase.initPlatformPrefix();
}
@SuppressWarnings("JUnitTestCaseWithNonTrivialConstructors")
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -26,7 +26,6 @@ import com.intellij.openapi.module.Module;
import com.intellij.openapi.options.SettingsEditor;
import com.intellij.openapi.project.Project;
import com.intellij.testFramework.LightPlatformTestCase;
import com.intellij.testFramework.PlatformTestCase;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.messages.MessageBus;
import com.intellij.util.messages.MessageBusConnection;
@@ -53,7 +52,6 @@ public class ModuleRunConfigurationManagerTest extends LightPlatformTestCase {
@Override
public void setUp() throws Exception {
PlatformTestCase.initPlatformLangPrefix();
super.setUp();
myModule = context.mock(Module.class, "myModule");
context.checking(new Expectations() {{
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -18,7 +18,6 @@ package com.intellij.openapi.editor;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.editor.ex.FoldingModelEx;
import com.intellij.openapi.editor.impl.AbstractEditorTest;
import com.intellij.testFramework.PlatformTestCase;
import com.intellij.testFramework.TestFileType;
import static org.junit.Assert.assertArrayEquals;
@@ -27,10 +26,6 @@ import static org.junit.Assert.assertArrayEquals;
* @author max
*/
public class FoldingTest extends AbstractEditorTest {
static {
PlatformTestCase.autodetectPlatformPrefix();
}
private FoldingModelEx myModel;
@Override
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -38,7 +38,6 @@ import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.impl.PsiManagerEx;
import com.intellij.testFramework.IdeaTestCase;
import com.intellij.testFramework.PlatformTestCase;
import com.intellij.testFramework.PlatformTestUtil;
import com.intellij.util.PatternUtil;
@@ -62,11 +61,6 @@ public class FileTypesTest extends PlatformTestCase {
private FileTypeManagerImpl myFileTypeManager;
private String myOldIgnoredFilesList;
@SuppressWarnings("JUnitTestCaseWithNonTrivialConstructors")
public FileTypesTest() {
IdeaTestCase.initPlatformPrefix();
}
@Override
protected void setUp() throws Exception {
super.setUp();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -25,6 +25,7 @@ import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.application.ex.ApplicationEx;
import com.intellij.openapi.application.ex.ApplicationManagerEx;
import com.intellij.openapi.util.Disposer;
import com.intellij.testFramework.PlatformTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -47,6 +48,7 @@ public class IdeaTestApplication extends CommandLineApplication implements Dispo
public static synchronized IdeaTestApplication getInstance(@Nullable final String configPath) {
if (ourInstance == null) {
PlatformTestCase.doAutodetectPlatformPrefix();
new IdeaTestApplication();
PluginManagerCore.getPlugins();
final ApplicationEx app = ApplicationManagerEx.getApplicationEx();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -18,6 +18,6 @@ package com.intellij.testFramework;
public abstract class LightPlatformLangTestCase extends LightPlatformTestCase {
@SuppressWarnings("JUnitTestCaseWithNonTrivialConstructors")
protected LightPlatformLangTestCase() {
PlatformTestCase.initPlatformLangPrefix();
PlatformTestCase.autodetectPlatformPrefix();
}
}
@@ -151,9 +151,16 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro
private static final String[] PREFIX_CANDIDATES = {
"AppCode", "CLion", "CidrCommon",
"Python", "PyCharmCore", "Ruby", "UltimateLangXml", "Idea" };
"Python", "PyCharmCore", "Ruby", "UltimateLangXml", "Idea", "PlatformLangXml" };
/**
* @deprecated calling this method is no longer necessary
*/
public static void autodetectPlatformPrefix() {
doAutodetectPlatformPrefix();
}
public static void doAutodetectPlatformPrefix() {
if (ourPlatformPrefixInitialized) {
return;
}
@@ -835,6 +842,9 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro
return PsiDocumentManager.getInstance(getProject()).getPsiFile(document);
}
/**
* @deprecated calling this method is no longer necessary
*/
public static void initPlatformLangPrefix() {
initPlatformPrefix(IDEA_MARKER_CLASS, "PlatformLangXml");
}
@@ -849,6 +859,7 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro
*
* @param classToTest marker class qualified name e.g. {@link #IDEA_MARKER_CLASS}.
* @param prefix platform prefix to be set up if marker class not found in classpath.
* @deprecated calling this method is no longer necessary
*/
public static void initPlatformPrefix(String classToTest, String prefix) {
if (!ourPlatformPrefixInitialized) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -17,15 +17,9 @@ package com.intellij.spellchecker.inspection;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.spellchecker.inspections.SpellCheckingInspection;
import com.intellij.testFramework.PlatformTestCase;
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
public abstract class SpellcheckerInspectionTestCase extends LightPlatformCodeInsightFixtureTestCase {
@SuppressWarnings("JUnitTestCaseWithNonTrivialConstructors")
protected SpellcheckerInspectionTestCase() {
PlatformTestCase.initPlatformLangPrefix();
}
@Override
protected boolean isCommunity() {
return true;