diff --git a/java/testFramework/src/com/intellij/testFramework/IdeaTestCase.java b/java/testFramework/src/com/intellij/testFramework/IdeaTestCase.java index c5372661a182..abdb236f010b 100644 --- a/java/testFramework/src/com/intellij/testFramework/IdeaTestCase.java +++ b/java/testFramework/src/com/intellij/testFramework/IdeaTestCase.java @@ -43,11 +43,6 @@ public abstract class IdeaTestCase extends PlatformTestCase { super.tearDown(); } - @SuppressWarnings({"JUnitTestCaseWithNonTrivialConstructors"}) - protected IdeaTestCase() { - initPlatformPrefix(); - } - public final JavaPsiFacadeEx getJavaFacade() { return myJavaFacade; } diff --git a/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java b/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java index c7a3c088f4d3..a1f279e041cb 100644 --- a/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java @@ -83,6 +83,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.lang.reflect.InvocationTargetException; +import java.net.URL; import java.util.Collection; import java.util.HashSet; import java.util.Set; @@ -125,6 +126,7 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro protected void initApplication() throws Exception { boolean firstTime = ourApplication == null; + autodetectPlatformPrefix(); ourApplication = IdeaTestApplication.getInstance(getApplicationConfigDirPath()); ourApplication.setDataProvider(this); @@ -133,6 +135,22 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro } } + private static void autodetectPlatformPrefix() { + if (ourPlatformPrefixInitialized) { + return; + } + URL resource = PlatformTestCase.class.getClassLoader().getResource("idea/ApplicationInfo.xml"); + if (resource == null) { + resource = PlatformTestCase.class.getClassLoader().getResource("idea/IdeaApplicationInfo.xml"); + if (resource == null) { + System.setProperty("idea.platform.prefix", "PlatformLangXml"); + } + else { + System.setProperty("idea.platform.prefix", "Idea"); + } + } + } + private static void cleanPersistedVFSContent() { ((PersistentFS)ManagingFS.getInstance()).cleanPersistedContents(); }