mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
checkForSettingsDamage(): throw after tearDown()
This commit is contained in:
@@ -141,4 +141,8 @@ public class CompositeException extends Exception {
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void throwIfNotEmpty() throws CompositeException {
|
||||
if (!isEmpty()) throw this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,7 +505,8 @@ public abstract class LightPlatformTestCase extends UsefulTestCase implements Da
|
||||
protected void tearDown() throws Exception {
|
||||
Project project = getProject();
|
||||
CodeStyleSettingsManager.getInstance(project).dropTemporarySettings();
|
||||
checkForSettingsDamage();
|
||||
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
|
||||
CompositeException damage = checkForSettingsDamage();
|
||||
VirtualFilePointerManagerImpl filePointerManager = (VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance();
|
||||
doTearDown(project, ourApplication, true);
|
||||
|
||||
@@ -517,6 +518,7 @@ public abstract class LightPlatformTestCase extends UsefulTestCase implements Da
|
||||
InjectedLanguageManagerImpl.checkInjectorsAreDisposed(project);
|
||||
filePointerManager.assertPointersAreDisposed();
|
||||
}
|
||||
damage.throwIfNotEmpty();
|
||||
}
|
||||
|
||||
public static void doTearDown(@NotNull final Project project, IdeaTestApplication application, boolean checkForEditors) throws Exception {
|
||||
|
||||
@@ -402,7 +402,8 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro
|
||||
}
|
||||
|
||||
try {
|
||||
checkForSettingsDamage();
|
||||
CompositeException damage = checkForSettingsDamage();
|
||||
result.add(damage);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
result.add(e);
|
||||
|
||||
@@ -213,19 +213,19 @@ public abstract class UsefulTestCase extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
protected void checkForSettingsDamage() throws Exception {
|
||||
protected CompositeException checkForSettingsDamage() throws Exception {
|
||||
Application app = ApplicationManager.getApplication();
|
||||
if (isPerformanceTest() || app == null || app instanceof MockApplication) {
|
||||
return;
|
||||
return new CompositeException();
|
||||
}
|
||||
|
||||
CodeStyleSettings oldCodeStyleSettings = myOldCodeStyleSettings;
|
||||
myOldCodeStyleSettings = null;
|
||||
|
||||
doCheckForSettingsDamage(oldCodeStyleSettings, getCurrentCodeStyleSettings());
|
||||
return doCheckForSettingsDamage(oldCodeStyleSettings, getCurrentCodeStyleSettings());
|
||||
}
|
||||
|
||||
public static void doCheckForSettingsDamage(@NotNull CodeStyleSettings oldCodeStyleSettings,
|
||||
public static CompositeException doCheckForSettingsDamage(@NotNull CodeStyleSettings oldCodeStyleSettings,
|
||||
@NotNull CodeStyleSettings currentCodeStyleSettings) throws Exception {
|
||||
CompositeException result = new CompositeException();
|
||||
final CodeInsightSettings settings = CodeInsightSettings.getInstance();
|
||||
@@ -266,7 +266,7 @@ public abstract class UsefulTestCase extends TestCase {
|
||||
result.add(e);
|
||||
}
|
||||
|
||||
if (!result.isEmpty()) throw result;
|
||||
return result;
|
||||
}
|
||||
|
||||
protected void storeSettings() {
|
||||
|
||||
+4
-5
@@ -29,10 +29,7 @@ import com.intellij.psi.codeStyle.CodeStyleSchemes;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
|
||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageManagerImpl;
|
||||
import com.intellij.testFramework.LightPlatformTestCase;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.testFramework.TestDataProvider;
|
||||
import com.intellij.testFramework.UsefulTestCase;
|
||||
import com.intellij.testFramework.*;
|
||||
import com.intellij.testFramework.fixtures.LightIdeaTestFixture;
|
||||
import gnu.trove.THashMap;
|
||||
|
||||
@@ -68,13 +65,15 @@ public class LightIdeaTestFixtureImpl extends BaseFixture implements LightIdeaTe
|
||||
CodeStyleSettingsManager.getInstance(project).dropTemporarySettings();
|
||||
CodeStyleSettings oldCodeStyleSettings = myOldCodeStyleSettings;
|
||||
myOldCodeStyleSettings = null;
|
||||
UsefulTestCase.doCheckForSettingsDamage(oldCodeStyleSettings, getCurrentCodeStyleSettings());
|
||||
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
|
||||
CompositeException damage = UsefulTestCase.doCheckForSettingsDamage(oldCodeStyleSettings, getCurrentCodeStyleSettings());
|
||||
|
||||
LightPlatformTestCase.doTearDown(project, LightPlatformTestCase.getApplication(), true);
|
||||
super.tearDown();
|
||||
InjectedLanguageManagerImpl.checkInjectorsAreDisposed(project);
|
||||
PersistentFS.getInstance().clearIdCache();
|
||||
((DirectoryIndexImpl)DirectoryIndex.getInstance(project)).assertAncestorConsistent();
|
||||
damage.throwIfNotEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user