Merge remote-tracking branch 'origin/master'
authorDmitry Avdeev <dmitry.avdeev@jetbrains.com>
Wed, 4 May 2016 09:22:39 +0000 (12:22 +0300)
committerDmitry Avdeev <dmitry.avdeev@jetbrains.com>
Wed, 4 May 2016 09:22:39 +0000 (12:22 +0300)
1  2 
platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java

index 8f161ae852f7587f6bee696d4a2a1ee566e9b026,75c5530092cc0e688a3b57bb2bce4ef324fa937d..7d07c15d161fdd3ec4eb48ce3daccfe03a604fef
@@@ -1057,18 -1057,13 +1057,13 @@@ public class CodeInsightTestFixtureImp
    public void moveFile(@NotNull final String filePath, @NotNull final String to, @NotNull final String... additionalFiles) {
      assertInitialized();
      final Project project = getProject();
-     new WriteCommandAction.Simple(project) {
-       @Override
-       protected void run() throws Exception {
-         configureByFiles(ArrayUtil.reverseArray(ArrayUtil.append(additionalFiles, filePath)));
-         final VirtualFile file = findFileInTempDir(to);
-         Assert.assertNotNull("Directory " + to + " not found", file);
-         Assert.assertTrue(to + " is not a directory", file.isDirectory());
-         final PsiDirectory directory = myPsiManager.findDirectory(file);
-         new MoveFilesOrDirectoriesProcessor(project, new PsiElement[]{getFile()}, directory,
-                                             false, false, null, null).run();
-       }
-     }.execute().throwException();
+     configureByFiles(ArrayUtil.reverseArray(ArrayUtil.append(additionalFiles, filePath)));
+     final VirtualFile file = findFileInTempDir(to);
+     Assert.assertNotNull("Directory " + to + " not found", file);
+     Assert.assertTrue(to + " is not a directory", file.isDirectory());
+     final PsiDirectory directory = myPsiManager.findDirectory(file);
+     new MoveFilesOrDirectoriesProcessor(project, new PsiElement[]{getFile()}, directory,
+                                         false, false, null, null).run();
    }
  
    @Override
      return result.toString();
    }
  
 -  private void testFoldingRegions(@NotNull String verificationFileName, boolean doCheckCollapseStatus) {
 +  private void testFoldingRegions(@NotNull String verificationFileName, @Nullable String destinationFileName, boolean doCheckCollapseStatus) {
      String expectedContent;
      try {
        expectedContent = FileUtil.loadFile(new File(verificationFileName));
  
      expectedContent = StringUtil.replace(expectedContent, "\r", "");
      final String cleanContent = expectedContent.replaceAll(START_FOLD, "").replaceAll(END_FOLD, "");
 -
 -    configureByText(FileTypeManager.getInstance().getFileTypeByFileName(verificationFileName), cleanContent);
 +    if (destinationFileName == null) {
 +      configureByText(FileTypeManager.getInstance().getFileTypeByFileName(verificationFileName), cleanContent);
 +    }
 +    else {
 +      try {
 +        FileUtil.writeToFile(new File(destinationFileName), cleanContent);
 +        configureFromExistingVirtualFile(LocalFileSystem.getInstance().refreshAndFindFileByPath(destinationFileName));
 +      }
 +      catch (IOException e) {
 +        throw new RuntimeException(e);
 +      }
 +    }
      final String actual = getFoldingDescription(doCheckCollapseStatus);
 -
      Assert.assertEquals(expectedContent, actual);
    }
  
    @Override
    public void testFoldingWithCollapseStatus(@NotNull final String verificationFileName) {
 -    testFoldingRegions(verificationFileName, true);
 +    testFoldingRegions(verificationFileName, null, true);
 +  }
 +
 +  @Override
 +  public void testFoldingWithCollapseStatus(@NotNull final String verificationFileName, @Nullable String destinationFileName) {
 +    testFoldingRegions(verificationFileName, destinationFileName, true);
    }
  
    @Override
    public void testFolding(@NotNull final String verificationFileName) {
 -    testFoldingRegions(verificationFileName, false);
 +    testFoldingRegions(verificationFileName, null, false);
    }
  
    @Override