CodeInsightTestCase: more safe tearDown

This commit is contained in:
Yann Cébron
2014-10-09 15:41:01 +02:00
parent c63ddf59ad
commit 8c521a748e
@@ -86,13 +86,19 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
@Override
protected void tearDown() throws Exception {
FileEditorManager editorManager = FileEditorManager.getInstance(myProject);
VirtualFile[] openFiles = editorManager.getOpenFiles();
for (VirtualFile openFile : openFiles) {
editorManager.closeFile(openFile);
try {
if (myProject != null) {
FileEditorManager editorManager = FileEditorManager.getInstance(myProject);
VirtualFile[] openFiles = editorManager.getOpenFiles();
for (VirtualFile openFile : openFiles) {
editorManager.closeFile(openFile);
}
}
}
finally {
myEditor = null;
super.tearDown();
}
myEditor = null;
super.tearDown();
}
@Override