Beispiel #1
0
  protected void tearDown() throws Exception {
    ((StartupManagerImpl) StartupManager.getInstance(getProject())).prepareForNextTest();
    checkAllTimersAreDisposed();

    CodeStyleSettingsManager.getInstance(getProject()).dropTemporarySettings();
    checkForSettingsDamage();
    doTearDown();

    super.tearDown();

    myThreadTracker.checkLeak();
  }
  @Override
  protected void tearDown() throws Exception {
    List<Throwable> exceptions = new SmartList<Throwable>();
    Project project = myProject;
    if (project != null) {
      try {
        LightPlatformTestCase.doTearDown(project, ourApplication, false, exceptions);
      } catch (Throwable e) {
        exceptions.add(e);
      }

      disposeProject(exceptions);
    }

    try {
      checkForSettingsDamage(exceptions);
    } catch (Throwable e) {
      exceptions.add(e);
    }
    try {
      if (project != null) {
        try {
          InjectedLanguageManagerImpl.checkInjectorsAreDisposed(project);
        } catch (AssertionError e) {
          exceptions.add(e);
        }
      }
      try {
        for (final File fileToDelete : myFilesToDelete) {
          delete(fileToDelete);
        }
        LocalFileSystem.getInstance().refreshIoFiles(myFilesToDelete);
      } catch (Throwable e) {
        exceptions.add(e);
      }

      if (!myAssertionsInTestDetected) {
        if (IdeaLogger.ourErrorsOccurred != null) {
          exceptions.add(IdeaLogger.ourErrorsOccurred);
        }
      }

      try {
        super.tearDown();
      } catch (Throwable e) {
        exceptions.add(e);
      }

      try {
        if (myEditorListenerTracker != null) {
          myEditorListenerTracker.checkListenersLeak();
        }
      } catch (AssertionError error) {
        exceptions.add(error);
      }
      try {
        if (myThreadTracker != null) {
          myThreadTracker.checkLeak();
        }
      } catch (AssertionError error) {
        exceptions.add(error);
      }
      try {
        LightPlatformTestCase.checkEditorsReleased(exceptions);
      } catch (Throwable error) {
        exceptions.add(error);
      }
    } finally {
      myProjectManager = null;
      myProject = null;
      myModule = null;
      myFilesToDelete.clear();
      myEditorListenerTracker = null;
      myThreadTracker = null;
      ourTestCase = null;
    }
    CompoundRuntimeException.throwIfNotEmpty(exceptions);
  }