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(