diff --git a/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java b/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java index 2da9ce6d28d5..d4bc09129695 100644 --- a/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java @@ -515,8 +515,15 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro Collection projectsStillOpen = projectManager.closeTestProject(myProject); if (!projectsStillOpen.isEmpty()) { Project project = projectsStillOpen.iterator().next(); - projectsStillOpen.clear(); - throw new AssertionError("Test project is not disposed: " + project+";\n created in: "+getCreationPlace(project)); + String message = "Test project is not disposed: " + project + ";\n created in: " + getCreationPlace(project); + try { + projectManager.closeTestProject(project); + Disposer.dispose(project); + } + catch (Exception e) { + // ignore, we already have somthing to throw + } + throw new AssertionError(message); } } } @@ -910,6 +917,27 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro }.execute().throwException(); } + protected static void move(@NotNull final VirtualFile vFile1, @NotNull final VirtualFile newFile) { + new WriteCommandAction.Simple(null) { + @Override + protected void run() throws Throwable { + vFile1.move(this, newFile); + } + }.execute().throwException(); + } + + protected static VirtualFile copy(@NotNull final VirtualFile file, @NotNull final VirtualFile newParent, @NotNull final String copyName) { + final VirtualFile[] copy = new VirtualFile[1]; + + new WriteCommandAction.Simple(null) { + @Override + protected void run() throws Throwable { + copy[0] = file.copy(this, newParent, copyName); + } + }.execute().throwException(); + return copy[0]; + } + public static void setFileText(@NotNull final VirtualFile file, @NotNull final String text) throws IOException { new WriteAction() { @Override