test outside write action

This commit is contained in:
Alexey Kudravtsev
2015-03-17 16:10:18 +03:00
parent 4d909e595a
commit f84e328bb1
@@ -515,8 +515,15 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro
Collection<Project> 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