Merge remote-tracking branch 'origin/master' into develar/is
[idea/community.git] / platform / testFramework / src / com / intellij / testFramework / LightPlatformTestCase.java
index 42373bd2d8000c24a8e0f58a72b617ee0d0ea3cb..c1f8cb9b004bfa0cd26bd9b7ba2da19a7ed03fec 100644 (file)
@@ -267,7 +267,7 @@ public abstract class LightPlatformTestCase extends UsefulTestCase implements Da
   @Override
   protected void setUp() throws Exception {
     EdtTestUtil.runInEdtAndWait((ThrowableRunnable<Throwable>)() -> {
-      LightPlatformTestCase.super.setUp();
+      super.setUp();
       initApplication();
       ApplicationInfoImpl.setInPerformanceTest(isPerformanceTest());
 
@@ -407,27 +407,23 @@ public abstract class LightPlatformTestCase extends UsefulTestCase implements Da
   protected void tearDown() throws Exception {
     Project project = getProject();
     CodeStyleSettingsManager.getInstance(project).dropTemporarySettings();
-    List<Throwable> errors = new SmartList<>();
-    try {
-      checkForSettingsDamage(errors);
-      doTearDown(project, ourApplication, true, errors);
-    }
-    catch (Throwable e) {
-      errors.add(e);
-    }
-
-    try {
-      //noinspection SuperTearDownInFinally
-      super.tearDown();
-    }
-    catch (Throwable e) {
-      errors.add(e);
-    }
-
+    List<Throwable> errors = ContainerUtil.newSmartList();
+    Function<ThrowableRunnable<?>, ?> runSafe = c -> {
+      try {
+        c.run();
+      }
+      catch (Throwable e) {
+        errors.add(e);
+      }
+      return true;
+    };
     try {
-      myThreadTracker.checkLeak();
-      InjectedLanguageManagerImpl.checkInjectorsAreDisposed(project);
-      ((VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance()).assertPointersAreDisposed();
+      runSafe.fun(() -> checkForSettingsDamage(errors));
+      runSafe.fun(() -> doTearDown(project, ourApplication, true, errors));
+      runSafe.fun(super::tearDown);
+      runSafe.fun(() -> myThreadTracker.checkLeak());
+      runSafe.fun(() -> InjectedLanguageManagerImpl.checkInjectorsAreDisposed(project));
+      runSafe.fun(() -> ((VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance()).assertPointersAreDisposed());
     }
     catch (Throwable e) {
       errors.add(e);