From 4810d3ee52d75496cf6e94df993de968315476f4 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Fri, 13 Jun 2014 11:45:08 +0400 Subject: [PATCH] cleanup --- .../com/intellij/openapi/vcs/VcsTestUtil.java | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/VcsTestUtil.java b/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/VcsTestUtil.java index 63f54a8c15b5..c7da2ad49a04 100644 --- a/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/VcsTestUtil.java +++ b/platform/vcs-impl/testSrc/com/intellij/openapi/vcs/VcsTestUtil.java @@ -19,7 +19,6 @@ import com.intellij.notification.Notification; import com.intellij.openapi.application.Result; import com.intellij.openapi.command.WriteCommandAction; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.CharsetToolkit; @@ -39,26 +38,18 @@ import static junit.framework.Assert.assertTrue; import static org.junit.Assert.*; public class VcsTestUtil { - public static VirtualFile createFile(@NotNull Project project, @NotNull final VirtualFile parent, @NotNull final String name, @Nullable final String content) { - final Ref result = new Ref(); - new WriteCommandAction.Simple(project) { + return new WriteCommandAction(project) { @Override - protected void run() throws Throwable { - try { - VirtualFile file = parent.createChildData(this, name); - if (content != null) { - file.setBinaryContent(CharsetToolkit.getUtf8Bytes(content)); - } - result.set(file); - } - catch (IOException e) { - throw new RuntimeException(e); + protected void run(@NotNull Result result) throws Throwable { + VirtualFile file = parent.createChildData(this, name); + if (content != null) { + file.setBinaryContent(CharsetToolkit.getUtf8Bytes(content)); } + result.setResult(file); } - }.execute(); - return result.get(); + }.execute().throwException().getResultObject(); } /**