diff options
Diffstat (limited to 'platform/testFramework/src/com')
5 files changed, 29 insertions, 12 deletions
diff --git a/platform/testFramework/src/com/intellij/testFramework/MockSchemesManagerFactory.java b/platform/testFramework/src/com/intellij/testFramework/MockSchemesManagerFactory.java index b74bb8e204b5..ab5ee3d9f7c6 100644 --- a/platform/testFramework/src/com/intellij/testFramework/MockSchemesManagerFactory.java +++ b/platform/testFramework/src/com/intellij/testFramework/MockSchemesManagerFactory.java @@ -2,16 +2,19 @@ package com.intellij.testFramework; import com.intellij.openapi.components.RoamingType; import com.intellij.openapi.options.*; +import org.jetbrains.annotations.NotNull; public class MockSchemesManagerFactory extends SchemesManagerFactory { @Override - public <T extends Scheme,E extends ExternalizableScheme> SchemesManager<T,E> createSchemesManager(final String fileSpec, - final SchemeProcessor<E> processor, final RoamingType roamingType) { + public <T extends Scheme, E extends ExternalizableScheme> SchemesManager<T, E> createSchemesManager(@NotNull String fileSpec, + @NotNull SchemeProcessor<E> processor, + @NotNull RoamingType roamingType) { + //noinspection unchecked return SchemesManager.EMPTY; } @Override public void updateConfigFilesFromStreamProviders() { - + } } diff --git a/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java b/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java index d9b32080f458..ea7a7c0deed1 100644 --- a/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java @@ -141,7 +141,7 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro } private static final String[] PREFIX_CANDIDATES = { - "AppCode", "CppIde", "CidrCommon", + "AppCode", "CLion", "CidrCommon", "Python", "PyCharmCore", "Ruby", "UltimateLangXml", "Idea" }; public static void autodetectPlatformPrefix() { diff --git a/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java index 307fb65e5ef1..ee6e519cb583 100644 --- a/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java +++ b/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java @@ -52,6 +52,7 @@ import com.intellij.util.io.ZipUtil; import com.intellij.util.ui.UIUtil; import junit.framework.AssertionFailedError; import org.jdom.Element; +import org.jdom.JDOMException; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -752,6 +753,18 @@ public class PlatformTestUtil { } } + public static void assertElementEquals(final String expected, final Element actual) { + try { + assertElementsEqual(JDOMUtil.loadDocument(expected).getRootElement(), actual); + } + catch (IOException e) { + throw new AssertionError(e); + } + catch (JDOMException e) { + throw new AssertionError(e); + } + } + public static String printElement(final Element element) throws IOException { final StringWriter writer = new StringWriter(); JDOMUtil.writeElement(element, writer, "\n"); diff --git a/platform/testFramework/src/com/intellij/testFramework/PlatformUltraLiteTestFixture.java b/platform/testFramework/src/com/intellij/testFramework/PlatformUltraLiteTestFixture.java index 5b01cf414149..ee6c3bd68304 100644 --- a/platform/testFramework/src/com/intellij/testFramework/PlatformUltraLiteTestFixture.java +++ b/platform/testFramework/src/com/intellij/testFramework/PlatformUltraLiteTestFixture.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -15,10 +15,10 @@ */ package com.intellij.testFramework; -import com.intellij.mock.MockApplication; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.application.impl.ApplicationImpl; import com.intellij.openapi.util.Disposer; import org.jetbrains.annotations.NotNull; @@ -28,21 +28,19 @@ public class PlatformUltraLiteTestFixture { return new PlatformUltraLiteTestFixture(); } - private Disposable myAppDisposable = null; + private final Disposable myAppDisposable = Disposer.newDisposable(); private PlatformUltraLiteTestFixture() { } public void setUp() { final Application application = ApplicationManager.getApplication(); if (application == null) { - myAppDisposable = Disposer.newDisposable(); - ApplicationManager.setApplication(new MockApplication(myAppDisposable), myAppDisposable); + ApplicationImpl testapp = new ApplicationImpl(false, true, true, true, "testapp", null); + ApplicationManager.setApplication(testapp, myAppDisposable); } } public void tearDown() { - if (myAppDisposable != null) { - Disposer.dispose(myAppDisposable); - } + Disposer.dispose(myAppDisposable); } } diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java index 449b1bacf8e9..8aafb17da1de 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java @@ -576,6 +576,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig @Override public void launchAction(@NotNull final IntentionAction action) { ShowIntentionActionsHandler.chooseActionAndInvoke(getFile(), getEditor(), action, action.getText()); + UIUtil.dispatchAllInvocationEvents(); } @Override @@ -1424,6 +1425,8 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig module.getMessageBus().syncPublisher(FacetManager.FACETS_TOPIC).facetConfigurationChanged(facet); } } + PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); + if (myCaresAboutInjection) { setupEditorForInjectedLanguage(); } |