mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
do not swallow exceptions in tearDown()
This commit is contained in:
@@ -85,6 +85,9 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase {
|
||||
}
|
||||
CompilerTestUtil.disableExternalCompiler(getProject());
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -435,6 +435,9 @@ public abstract class CompilerTestCase extends ModuleTestCase {
|
||||
myOriginalSourceDir = null;
|
||||
CompilerTestUtil.disableExternalCompiler(myProject);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -46,6 +46,9 @@ public class ModuleCompilerUtilTest extends ModuleTestCase {
|
||||
try {
|
||||
myTempDirTestFixture.tearDown();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -21,6 +21,9 @@ public abstract class FacetTestCase extends PsiTestCase {
|
||||
try {
|
||||
removeAllFacets();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@ public abstract class FrameworkDetectionTestCase extends PlatformTestCase {
|
||||
try {
|
||||
FrameworkDetectionManager.getInstance(myProject).doDispose();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -138,6 +138,9 @@ public class SaveProjectAsTemplateTest extends NewProjectWizardTestCase {
|
||||
((FileTemplateManagerImpl)FileTemplateManager.getDefaultInstance()).setTestDate(null);
|
||||
PropertiesComponent.getInstance().unsetValue(ProjectTemplateParameterFactory.IJ_BASE_PACKAGE);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+2
-6
@@ -35,12 +35,8 @@ public abstract class AbstractParameterInfoTestCase extends LightFixtureCompleti
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
try {
|
||||
CodeInsightSettings.getInstance().PARAMETER_INFO_DELAY = myStoredAutoPopupDelay;
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
CodeInsightSettings.getInstance().PARAMETER_INFO_DELAY = myStoredAutoPopupDelay;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
protected void configureJava(String text) {
|
||||
|
||||
@@ -26,6 +26,9 @@ public class NullableNotNullManagerTest extends LightPlatformTestCase {
|
||||
try {
|
||||
myManager.loadState(new Element("x"));
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -41,6 +41,9 @@ public class ReformatCodeActionInEditorTest extends LightPlatformCodeInsightFixt
|
||||
try {
|
||||
myFixture.getFile().putUserData(FormatChangedTextUtil.TEST_REVISION_CONTENT, null);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -36,6 +36,9 @@ public class CompletionHintsTest extends AbstractParameterInfoTestCase {
|
||||
try {
|
||||
CodeInsightSettings.getInstance().SHOW_PARAMETER_NAME_HINTS_ON_COMPLETION = myStoredSettingValue;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -37,6 +37,9 @@ public abstract class CompletionSortingTestCase extends LightFixtureCompletionTe
|
||||
LookupManager.hideActiveLookup(getProject());
|
||||
UISettings.getInstance().setSortLookupElementsLexicographically(false);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -329,6 +329,9 @@ public class CompletionStyleTest extends LightCodeInsightTestCase{
|
||||
try {
|
||||
LookupManager.hideActiveLookup(getProject());
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -20,6 +20,9 @@ public class EditorTabOutTest extends AbstractParameterInfoTestCase {
|
||||
try {
|
||||
CodeInsightSettings.getInstance().TAB_EXITS_BRACKETS_AND_QUOTES = mySavedTabOutSetting;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+5
-1
@@ -40,7 +40,11 @@ public class MethodChainsCompletionTest extends AbstractCompilerAwareTest {
|
||||
public void tearDown() throws Exception {
|
||||
try {
|
||||
CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_SMART_TYPE_COMPLETION = myDefaultAutoCompleteOnCodeCompletion;
|
||||
} finally {
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -64,6 +64,9 @@ public class LightAdvHighlightingPerformanceTest extends LightDaemonAnalyzerTest
|
||||
try {
|
||||
Disposer.dispose(my);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -51,6 +51,9 @@ public class LossyEncodingTest extends DaemonAnalyzerTestCase {
|
||||
try {
|
||||
UIUtil.dispatchAllInvocationEvents(); // invokeLater() in EncodingProjectManagerImpl.reloadAllFilesUnder()
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -37,6 +37,9 @@ public abstract class SdkSetupNotificationTestBase extends JavaCodeInsightFixtur
|
||||
try {
|
||||
FileEditorManagerEx.getInstanceEx(getProject()).closeAllFiles();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -72,6 +72,9 @@ public class TypeInference18Test extends ResolveTestCase {
|
||||
try {
|
||||
LanguageLevelProjectExtension.getInstance(myJavaFacade.getProject()).setLanguageLevel(myOldLanguageLevel);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -39,6 +39,9 @@ public class AnnotateMethodInGeneratedFilesTest extends LightCodeInsightFixtureT
|
||||
try {
|
||||
Extensions.getRootArea().getExtensionPoint(GeneratedSourcesFilter.EP_NAME).unregisterExtension(myGeneratedSourcesFilter);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -69,6 +69,9 @@ public class OrderEntryTest extends DaemonAnalyzerTestCase {
|
||||
try {
|
||||
removeLibs();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -51,6 +51,9 @@ public class Simplify2DiamondInspectionsTest extends LightQuickFixParameterizedT
|
||||
try {
|
||||
getSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS = myAlignment;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -39,6 +39,9 @@ public abstract class JavaFoldingTestCase extends LightCodeInsightFixtureTestCas
|
||||
try {
|
||||
((JavaCodeFoldingSettingsImpl)myFoldingSettings).loadState(((JavaCodeFoldingSettingsImpl)myFoldingSettingsBackup));
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -35,6 +35,9 @@ public class LiveTemplateEditorActionsTest extends LightCodeInsightFixtureTestCa
|
||||
templateState.gotoEnd(false);
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -32,6 +32,9 @@ public class TemplatesCompletionTest extends CompletionAutoPopupTestCase {
|
||||
settings.setPostfixTemplatesEnabled(true);
|
||||
settings.setTemplatesCompletionEnabled(true);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -37,6 +37,9 @@ public class LambdaPostfixTemplateTest extends PostfixTemplateTestCase {
|
||||
LanguageLevelProjectExtension.getInstance(myFixture.getProject()).setLanguageLevel(myDefaultLanguageLevel);
|
||||
myDefaultLanguageLevel = null;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -22,6 +22,9 @@ public class ObjectsRequireNonNullPostfixTemplateTest extends PostfixTemplateTes
|
||||
LanguageLevelProjectExtension.getInstance(myFixture.getProject()).setLanguageLevel(myDefaultLanguageLevel);
|
||||
myDefaultLanguageLevel = null;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -37,6 +37,9 @@ public class OptionalPostfixTemplateTest extends PostfixTemplateTestCase {
|
||||
LanguageLevelProjectExtension.getInstance(myFixture.getProject()).setLanguageLevel(myDefaultLanguageLevel);
|
||||
myDefaultLanguageLevel = null;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -37,6 +37,9 @@ public class StreamPostfixTemplateTest extends PostfixTemplateTestCase {
|
||||
LanguageLevelProjectExtension.getInstance(myFixture.getProject()).setLanguageLevel(myDefaultLanguageLevel);
|
||||
myDefaultLanguageLevel = null;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -54,6 +54,9 @@ public class NullableStuffInspectionTest extends LightCodeInsightFixtureTestCase
|
||||
myInspection = null;
|
||||
Extensions.getRootArea().getExtensionPoint(GeneratedSourcesFilter.EP_NAME).unregisterExtension(myGeneratedSourcesFilter);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -33,6 +33,9 @@ public abstract class CompilerReferencesTestBase extends AbstractCompilerAwareTe
|
||||
try {
|
||||
CompilerReferenceService.IS_ENABLED_KEY.setValue(myDefaultEnableState);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -34,6 +34,9 @@ public class JavaHighlighterTest extends LightCodeInsightTestCase {
|
||||
EditorFactory.getInstance().releaseEditor(editor);
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -54,6 +54,9 @@ public abstract class AbstractTestFrameworkCompilingIntegrationTest extends Abst
|
||||
try {
|
||||
myCompilerTester.tearDown();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -44,6 +44,9 @@ public abstract class BaseConfigurationTestCase extends IdeaTestCase {
|
||||
try {
|
||||
myModulesToDispose.clear();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -229,6 +229,9 @@ public class ConfigurationRefactoringsTest extends BaseConfigurationTestCase {
|
||||
mySource.tearDown();
|
||||
mySource = null;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -64,6 +64,9 @@ public abstract class JavaFileStructureTestCase extends FileStructureTestBase {
|
||||
try {
|
||||
PropertiesComponent.getInstance().setValue(getAnonymousPropertyName(), myShowAnonymousByDefault);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+6
-3
@@ -101,16 +101,19 @@ public abstract class AbstractApplyAndRevertTestCase extends PlatformTestCase {
|
||||
|
||||
@Override
|
||||
public void tearDown() throws Exception {
|
||||
if (myCompilerTester != null) {
|
||||
myCompilerTester.tearDown();
|
||||
}
|
||||
try {
|
||||
if (myCompilerTester != null) {
|
||||
myCompilerTester.tearDown();
|
||||
}
|
||||
PathMacros.getInstance().setMacro(PathMacrosImpl.MAVEN_REPOSITORY, oldMacroValue);
|
||||
ProjectManager.getInstance().closeProject(myProject);
|
||||
WriteAction.run(() -> Disposer.dispose(myProject));
|
||||
myProject = null;
|
||||
InspectionProfileImpl.INIT_INSPECTIONS = false;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -35,6 +35,9 @@ public class Java12SwitchExpressionSanityTest extends LightCodeInsightFixtureTes
|
||||
try {
|
||||
JavaAwareProjectJdkTableImpl.removeInternalJdkInTests();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
-1
@@ -5,7 +5,6 @@ import com.intellij.java.psi.formatter.java.AbstractJavaFormatterTest;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaAwareProjectJdkTableImpl;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.codeStyle.JavaCodeStyleSettings;
|
||||
import com.intellij.psi.impl.source.PsiEnumConstantImpl;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.testFramework.SkipSlowTestLocally;
|
||||
@@ -31,6 +30,9 @@ public class JavaCodeInsightSanityTest extends LightCodeInsightFixtureTestCase {
|
||||
try {
|
||||
JavaAwareProjectJdkTableImpl.removeInternalJdkInTests();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -44,6 +44,9 @@ public class Src15RepositoryUseTest extends PsiTestCase {
|
||||
try {
|
||||
LanguageLevelProjectExtension.getInstance(myProject).setLanguageLevel(LanguageLevel.JDK_1_5);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -56,6 +56,9 @@ public class DetectIndentAndTypeTest extends LightPlatformCodeInsightFixtureTest
|
||||
optionsProvider.setEnabledInTest(false);
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -71,6 +71,9 @@ public class UpdateCacheTest extends PsiTestCase {
|
||||
try {
|
||||
ProjectManager.getInstance().closeProject(myProject);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -33,6 +33,9 @@ public class LanguageLevelComboTest extends LightPlatformTestCase {
|
||||
try {
|
||||
ProjectManagerEx.getInstanceEx().closeAndDispose(myProject);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -55,6 +55,9 @@ public class ProjectTreeSortingTest extends BaseProjectViewTestCase {
|
||||
myProjectView = null;
|
||||
myPane = null;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -46,6 +46,9 @@ public class ScopeViewPaneTest extends TestSourceBasedTestCase {
|
||||
try {
|
||||
restoreProjectViewDefaultSettings();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
-1
@@ -38,7 +38,6 @@ public abstract class LightCompletionTestCase extends LightCodeInsightTestCase {
|
||||
protected void tearDown() throws Exception {
|
||||
try {
|
||||
myItems = null;
|
||||
LookupManager.getInstance(getProject()).hideActiveLookup();
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
|
||||
+3
@@ -95,6 +95,9 @@ public abstract class LightCodeInsightFixtureTestCase extends UsefulTestCase {
|
||||
try {
|
||||
myFixture.tearDown();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
myFixture = null;
|
||||
myModule = null;
|
||||
|
||||
@@ -66,6 +66,9 @@ public class VcsRepositoryManagerTest extends VcsPlatformTest {
|
||||
getExtensionPoint().unregisterExtension(myMockCreator);
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -33,6 +33,9 @@ public class ExecutionManagerTest extends LightPlatformTestCase {
|
||||
RunManagerConfig config = RunManagerImpl.getInstanceImpl(getProject()).getConfig();
|
||||
config.setRestartRequiresConfirmation(myRestartRequiresConfirmation);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -44,6 +44,9 @@ public class FindUIHelperTest extends LightPlatformTestCase {
|
||||
assertTrue(Disposer.isDisposed(myUICopy.getDisposable()));
|
||||
assertNull(myHelper.myUI);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -39,6 +39,9 @@ public abstract class ToolWindowManagerTestCase extends LightPlatformCodeInsight
|
||||
((ComponentManagerImpl)getProject()).registerComponentInstance(ToolWindowManager.class, myOldManager);
|
||||
myOldManager = null;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -61,6 +61,9 @@ public class ConsoleViewImplTest extends LightPlatformTestCase {
|
||||
try {
|
||||
Disposer.dispose(myConsole);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -86,6 +86,9 @@ public abstract class IntegrationTestCase extends PlatformTestCase {
|
||||
Clock.reset();
|
||||
Paths.useSystemCaseSensitivity();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -38,6 +38,9 @@ public class LocalHistoryStorageTest extends IntegrationTestCase {
|
||||
try {
|
||||
Disposer.dispose(myStorage);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -57,6 +57,9 @@ public class LocalHistoryActionsTest extends LocalHistoryUITestCase {
|
||||
try {
|
||||
getEditorFactory().releaseEditor(editor);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -51,6 +51,9 @@ public class BookmarkManagerTest extends AbstractEditorTest {
|
||||
}
|
||||
myBookmarks.clear();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -52,6 +52,9 @@ public class CodeStyleSchemesModelTest extends CodeStyleTestCase {
|
||||
myModel.selectScheme(myDefaultScheme, null);
|
||||
myModel.apply();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
-2
@@ -15,13 +15,11 @@
|
||||
*/
|
||||
package com.intellij.ide.codeStyleSettings;
|
||||
|
||||
import com.intellij.idea.Bombed;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
|
||||
import com.intellij.util.containers.ContainerUtilRt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Map;
|
||||
|
||||
public class NewProjectSettingsTest extends CodeStyleTestCase {
|
||||
@@ -47,6 +45,9 @@ public class NewProjectSettingsTest extends CodeStyleTestCase {
|
||||
try {
|
||||
restoreDefaults();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -43,6 +43,9 @@ public class ProjectCodeStyleMigrationTest extends CodeStyleTestCase {
|
||||
try {
|
||||
CodeStyle.getSettings(getProject()).copyFrom(CodeStyleSettings.getDefaults());
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -244,6 +244,9 @@ public class LightFileTemplatesTest extends LightPlatformTestCase {
|
||||
myTemplateManager.setCurrentScheme(FileTemplatesScheme.DEFAULT);
|
||||
PropertiesComponent.getInstance().unsetValue("FileTemplates.SelectedTemplate");
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+5
-1
@@ -68,7 +68,11 @@ public class PresentationTest extends PlatformTestCase {
|
||||
UISettingsState uiSettings = UISettings.getInstance().getState();
|
||||
uiSettings.setDisableMnemonics(defaults.getDisableMnemonics());
|
||||
uiSettings.setDisableMnemonicsInControls(defaults.getDisableMnemonicsInControls());
|
||||
} finally {
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -52,6 +52,9 @@ public abstract class FoldingTestCase extends PlatformTestCase {
|
||||
}
|
||||
myEditorsToDispose.clear();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -46,6 +46,9 @@ public class EditorMultiCaretTest extends AbstractEditorTest {
|
||||
try {
|
||||
EditorSettingsExternalizable.getInstance().setVirtualSpace(myStoredVirtualSpaceSetting);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -41,6 +41,9 @@ public class EditorMultiCaretUndoRedoTest extends AbstractEditorTest {
|
||||
try {
|
||||
getUndoManager().setEditorProvider(mySavedCurrentEditorProvider);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -39,6 +39,9 @@ public class MarkerTreeWithPartialSumsTest extends AbstractEditorTest {
|
||||
try {
|
||||
if (myTree != null) myTree.dispose(myDocument);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -53,6 +53,9 @@ public class TrailingSpacesStripperTest extends LightPlatformCodeInsightTestCase
|
||||
try {
|
||||
EditorSettingsExternalizable.getInstance().loadState(oldSettings);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -51,6 +51,9 @@ public class SoftWrapApplianceOnDocumentModificationTest extends AbstractEditorT
|
||||
settings.setSmartHome(mySmartHome);
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -47,6 +47,9 @@ public class FileEditorManagerTest extends FileEditorManagerTestCase {
|
||||
uiSettings.setReuseNotModifiedTabs(template.getReuseNotModifiedTabs());
|
||||
uiSettings.setEditorTabPlacement(template.getEditorTabPlacement());
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -81,6 +81,9 @@ public class IdeDocumentHistoryTest extends PlatformTestCase {
|
||||
myState2 = null;
|
||||
myState3 = null;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -44,6 +44,9 @@ public class IdeKeyEventDispatcherTest extends LightPlatformTestCase {
|
||||
KeymapManagerEx.getInstanceEx().setActiveKeymap(mySavedKeymap);
|
||||
ActionManager.getInstance().unregisterAction(ACTION_EMPTY);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -60,6 +60,9 @@ public class IdeMouseEventDispatcherTest extends LightPlatformTestCase {
|
||||
KeymapManagerEx.getInstanceEx().setActiveKeymap(mySavedKeymap);
|
||||
ActionManager.getInstance().unregisterAction(OUR_TEST_ACTION);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -95,6 +95,9 @@ public class ModifierKeyDoubleClickHandlerTest extends LightPlatformTestCase {
|
||||
ActionManager.getInstance().unregisterAction(MY_SHIFT_SHIFT_ACTION);
|
||||
Clock.reset();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -172,6 +172,9 @@ public class ActionsTreeTest extends LightPlatformCodeInsightTestCase {
|
||||
((KeymapManagerImpl)KeymapManager.getInstance()).unbindShortcuts(ACTION_WITH_USE_SHORTCUT_OF_EXISTENT_ACTION_REDEFINED_IN_PARENT);
|
||||
((KeymapManagerImpl)KeymapManager.getInstance()).unbindShortcuts(ACTION_WITH_USE_SHORTCUT_OF_NON_EXISTENT_ACTION);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -99,6 +99,9 @@ public class ModulesConfigurationTest extends PlatformTestCase {
|
||||
try {
|
||||
ApplicationManagerEx.getApplicationEx().setSaveAllowed(isSaveAllowed);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -98,6 +98,9 @@ public class FileEncodingTest extends PlatformTestCase implements TestDialog {
|
||||
try {
|
||||
Messages.setTestDialog(myOldTestDialogValue);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -68,6 +68,9 @@ public class VirtualFilePointerTest extends LightPlatformTestCase {
|
||||
assertEquals(numberOfListenersBefore, nListeners);
|
||||
assertEquals(pointersBefore, pointersAfter);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -37,6 +37,9 @@ public class PsiAvailabilityServiceTest extends PlatformTestCase {
|
||||
try {
|
||||
LaterInvocator.leaveAllModals();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -91,6 +91,9 @@ public class PsiDocumentManagerImplTest extends PlatformTestCase {
|
||||
try {
|
||||
LaterInvocator.leaveAllModals();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -87,6 +87,9 @@ public class PersistencePerformanceTest extends LightPlatformCodeInsightFixtureT
|
||||
myEnumerator = null;
|
||||
myMaps.clear();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -182,6 +182,9 @@ public class CertificateTest extends LightPlatformTestCase {
|
||||
try {
|
||||
myClient.close();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -50,6 +50,9 @@ public class GeneralIdBasedToSMTRunnerEventsConvertorTest extends BaseSMTRunnerT
|
||||
Disposer.dispose(myEventsProcessor);
|
||||
Disposer.dispose(myConsole);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -68,6 +68,9 @@ public class SMTRunnerConsoleTest extends BaseSMTRunnerTestCase {
|
||||
Disposer.dispose(myEventsProcessor);
|
||||
Disposer.dispose(myConsole);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -63,6 +63,9 @@ public class SMTRunnerIntegrationTest extends LightPlatformTestCase {
|
||||
myProcessHandler.destroyProcess();
|
||||
Disposer.dispose(myConsole);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class RunAll implements Runnable {
|
||||
this(ContainerUtil.newArrayList(actions));
|
||||
}
|
||||
|
||||
public RunAll(@NotNull List<? extends ThrowableRunnable<?>> actions) {
|
||||
private RunAll(@NotNull List<? extends ThrowableRunnable<?>> actions) {
|
||||
myActions = actions;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,12 @@ public class RunAll implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
CompoundRuntimeException.throwIfNotEmpty(collectExceptions());
|
||||
run(Collections.emptyList());
|
||||
}
|
||||
public void run(@NotNull List<? extends Throwable> suppressedExceptions) {
|
||||
List<Throwable> throwables = collectExceptions();
|
||||
throwables.addAll(0, suppressedExceptions);
|
||||
CompoundRuntimeException.throwIfNotEmpty(throwables);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -106,6 +106,35 @@ public abstract class UsefulTestCase extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pass here the exception you want to be thrown first
|
||||
* E.g.<pre>
|
||||
* {@code
|
||||
* void tearDown() {
|
||||
* try {
|
||||
* doTearDowns();
|
||||
* }
|
||||
* catch(Exception e) {
|
||||
* addSuppressedException(e);
|
||||
* }
|
||||
* finally {
|
||||
* super.tearDown();
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
protected void addSuppressedException(@NotNull Throwable e) {
|
||||
List<Throwable> list = mySuppressedExceptions;
|
||||
if (list == null) {
|
||||
mySuppressedExceptions = list = new SmartList<>();
|
||||
}
|
||||
list.add(e);
|
||||
}
|
||||
private List<Throwable> mySuppressedExceptions;
|
||||
|
||||
|
||||
public UsefulTestCase() {
|
||||
}
|
||||
|
||||
@@ -173,7 +202,7 @@ public abstract class UsefulTestCase extends TestCase {
|
||||
}
|
||||
},
|
||||
() -> UIUtil.removeLeakingAppleListeners()
|
||||
).run();
|
||||
).run(ObjectUtils.notNull(mySuppressedExceptions, Collections.emptyList()));
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
|
||||
+38
-2
@@ -19,11 +19,16 @@ import com.intellij.concurrency.IdeaForkJoinWorkerThreadFactory;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.testFramework.EdtTestUtil;
|
||||
import com.intellij.testFramework.RunAll;
|
||||
import com.intellij.testFramework.UsefulTestCase;
|
||||
import com.intellij.testFramework.fixtures.IdeaTestFixture;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
@@ -49,8 +54,10 @@ public class BaseFixture implements IdeaTestFixture {
|
||||
public void tearDown() throws Exception {
|
||||
Assert.assertTrue("setUp() has not been called", myInitialized);
|
||||
Assert.assertFalse("tearDown() already has been called", myDisposed);
|
||||
UsefulTestCase.waitForAppLeakingThreads(10, TimeUnit.SECONDS);
|
||||
disposeRootDisposable();
|
||||
new RunAll(
|
||||
() -> UsefulTestCase.waitForAppLeakingThreads(10, TimeUnit.SECONDS),
|
||||
() -> disposeRootDisposable()
|
||||
).run(ObjectUtils.notNull(mySuppressedExceptions, ContainerUtil.emptyList()));
|
||||
myDisposed = true;
|
||||
resetClassFields(getClass());
|
||||
}
|
||||
@@ -80,4 +87,33 @@ public class BaseFixture implements IdeaTestFixture {
|
||||
public final Disposable getTestRootDisposable() {
|
||||
return myTestRootDisposable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pass here the exception you want to be thrown first
|
||||
* E.g.<pre>
|
||||
* {@code
|
||||
* void tearDown() {
|
||||
* try {
|
||||
* doTearDowns();
|
||||
* }
|
||||
* catch(Exception e) {
|
||||
* addSuppressedException(e);
|
||||
* }
|
||||
* finally {
|
||||
* super.tearDown();
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
protected void addSuppressedException(@NotNull Throwable e) {
|
||||
List<Throwable> list = mySuppressedExceptions;
|
||||
if (list == null) {
|
||||
mySuppressedExceptions = list = new SmartList<>();
|
||||
}
|
||||
list.add(e);
|
||||
}
|
||||
private List<Throwable> mySuppressedExceptions;
|
||||
|
||||
}
|
||||
+3
@@ -60,6 +60,9 @@ public class LightTempDirTestFixtureImpl extends BaseFixture implements TempDirT
|
||||
try {
|
||||
deleteAll();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -140,6 +140,9 @@ public class TempDirTestFixtureImpl extends BaseFixture implements TempDirTestFi
|
||||
WriteAction.runAndWait(() -> findOrCreateDir("").delete(this));
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -83,6 +83,9 @@ public class VcsLogRefresherTest extends VcsPlatformTest {
|
||||
fail("Only one refresh should have happened, an error happened instead: " + myDataWaiter.getExceptionText());
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -62,6 +62,9 @@ public class DirectoryMappingListTest extends PlatformTestCase {
|
||||
myMappings.disposeMe();
|
||||
((AllVcses)myVcses).dispose();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -87,6 +87,9 @@ public class IgnoreIdeaLevelTest extends PlatformTestCase {
|
||||
|
||||
UsefulTestCase.clearDeclaredFields(this, IgnoreIdeaLevelTest.class);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
+3
@@ -42,6 +42,9 @@ public class SuspiciousPackagePrivateAccessInspectionTest extends LightInspectio
|
||||
try {
|
||||
myProjectDescriptor.cleanUpSources();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -128,6 +128,9 @@ public class CoverageAnnotatorIntegrationTest extends ModuleTestCase {
|
||||
try {
|
||||
myCompilerTester.tearDown();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -46,6 +46,9 @@ public class PropertiesCharsetTest extends CodeInsightTestCase {
|
||||
EncodingManager.getInstance().setDefaultCharsetName(myOldCharset.name());
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -62,6 +62,9 @@ public class XmlCompletionTest extends LightCodeInsightFixtureTestCase {
|
||||
try {
|
||||
ExternalResourceManagerEx.getInstanceEx().setDefaultHtmlDoctype(myOldDoctype, getProject());
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -2209,6 +2209,9 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
try {
|
||||
XmlSettings.getInstance().SHOW_XML_ADD_IMPORT_HINTS = old;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -43,6 +43,9 @@ public class XmlHighlighterTest extends LightCodeInsightTestCase {
|
||||
EditorFactory.getInstance().releaseEditor(editor);
|
||||
editor = null;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -40,6 +40,9 @@ public class HtmlFileStructureTest extends FileStructureTestBase {
|
||||
try {
|
||||
PropertiesComponent.getInstance().setValue(getHtml5OutlineModePropertyName(), myHtml5OutlineModeDefault);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user