mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
test outside write action
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user