From 2081d8f4588fbf33256545c4db287b3533c18d87 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Fri, 11 Mar 2016 20:53:31 +0300 Subject: [PATCH] Fixes after LightPlatformCodeInsightTestCase stopped execution test under write action by default See 1d1025401ffb7a06b3340069e06dad14a2e73ddd in intellij-community https://github.com/JetBrains/intellij-community/commit/1d1025401ffb7a06b3340069e06dad14a2e73ddd --- .../surroundWith/AbstractSurroundWithTest.java | 5 +++++ .../unwrap/AbstractUnwrapRemoveTest.java | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/surroundWith/AbstractSurroundWithTest.java b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/surroundWith/AbstractSurroundWithTest.java index cd9da41f38a..43e93ed1855 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/surroundWith/AbstractSurroundWithTest.java +++ b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/surroundWith/AbstractSurroundWithTest.java @@ -125,6 +125,11 @@ public abstract class AbstractSurroundWithTest extends LightCodeInsightTestCase return null; } + @Override + protected boolean isRunInWriteAction() { + return true; + } + @NotNull @Override protected String getTestDataPath() { diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/unwrap/AbstractUnwrapRemoveTest.java b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/unwrap/AbstractUnwrapRemoveTest.java index 50c50ecef21..e8679a21883 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/unwrap/AbstractUnwrapRemoveTest.java +++ b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/unwrap/AbstractUnwrapRemoveTest.java @@ -17,6 +17,7 @@ package org.jetbrains.kotlin.idea.codeInsight.unwrap; import com.intellij.codeInsight.unwrap.Unwrapper; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.io.FileUtil; @@ -89,10 +90,18 @@ public abstract class AbstractUnwrapRemoveTest extends LightCodeInsightTestCase new KotlinUnwrapDescriptor().collectUnwrappers(getProject(), getEditor(), getFile()); if (isApplicableExpected) { - Pair selectedUnwrapperWithPsi = unwrappersWithPsi.get(optionIndex); + final Pair selectedUnwrapperWithPsi = unwrappersWithPsi.get(optionIndex); assertEquals(unwrapperClass, selectedUnwrapperWithPsi.second.getClass()); - selectedUnwrapperWithPsi.second.unwrap(getEditor(), selectedUnwrapperWithPsi.first); + final PsiElement first = selectedUnwrapperWithPsi.first; + + ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override + public void run() { + selectedUnwrapperWithPsi.second.unwrap(getEditor(), first); + } + }); + checkResultByFile(path + ".after"); } else { assertTrue(