diff --git a/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java b/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java index bc544dcf9b2f..60f9b1a004f0 100644 --- a/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * Copyright 2000-2017 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.actionSystem.DataContext; import com.intellij.openapi.actionSystem.IdeActions; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.Result; +import com.intellij.openapi.application.WriteAction; import com.intellij.openapi.application.ex.PathManagerEx; import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.command.WriteCommandAction; @@ -208,7 +209,7 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); Editor editor = FileEditorManager.getInstance(getProject()).openTextEditor(new OpenFileDescriptor(getProject(), file, 0), false); DaemonCodeAnalyzer.getInstance(getProject()).restart(); - + assertNotNull(editor); ((EditorImpl)editor).setCaretActive(); return editor; } @@ -279,16 +280,11 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest private static void deleteVFile() throws IOException { if (myVFile != null) { - ApplicationManager.getApplication().runWriteAction(new ThrowableComputable() { - @Override - public Void compute() throws IOException { - // avoid messing with invalid files, in case someone calls configureXXX() several times - PsiDocumentManager.getInstance(ourProject).commitAllDocuments(); - FileEditorManager.getInstance(ourProject).closeFile(myVFile); - - myVFile.delete(this); - return null; - } + WriteAction.run(() -> { + // avoid messing with invalid files, in case someone calls configureXXX() several times + PsiDocumentManager.getInstance(ourProject).commitAllDocuments(); + FileEditorManager.getInstance(ourProject).closeFile(myVFile); + myVFile.delete(ourProject); }); } } diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/BareTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/BareTestFixtureImpl.java index 9344ed4bb311..d8a25fdf9108 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/BareTestFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/BareTestFixtureImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2017 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. @@ -30,8 +30,9 @@ public class BareTestFixtureImpl extends BaseFixture implements BareTestFixture @Override public void tearDown() throws Exception { - new RunAll(() -> EdtTestUtil.runInEdtAndWait(() -> PlatformTestCase.cleanupApplicationCaches(null)), - () -> super.tearDown()) - .run(); + new RunAll( + () -> EdtTestUtil.runInEdtAndWait(() -> PlatformTestCase.cleanupApplicationCaches(null)), + () -> super.tearDown() + ).run(); } } \ No newline at end of file