Merge branch 'master' into no-reformat-dialog-on-reformat-code-action
[idea/community.git] / java / java-tests / testSrc / com / intellij / codeInsight / actions / ReformatCodeActionTest.java
index b0e4024ff076fe28602f9dc5b65ee55892efe9d2..09dff801a2f531915c8962a24dccb9d4df39b8a1 100644 (file)
@@ -35,35 +35,10 @@ public class ReformatCodeActionTest extends AbstractLayoutCodeProcessorTest {
   public void testReformatAndOptimizeMultipleFiles() throws IOException {
     List<PsiFile> files = createTestFiles(getTempRootDirectory(), classNames);
     injectMockDialogFlags(new MockReformatFileSettings().setOptimizeImports(true));
-
     performReformatActionOnSelectedFiles(files);
     checkFormationAndImportsOptimizationFor(files);
   }
 
-  public void testReformatSingleSelectedFile() throws IOException {
-    List<PsiFile> files = createTestFiles(getTempRootDirectory(), classNames);
-    PsiFile fileToReformat = files.get(0);
-    List<PsiFile> shouldNotBeFormatted = files.subList(1, files.size());
-    injectMockDialogFlags(new MockReformatFileSettings().setOptimizeImports(true));
-
-    performReformatActionOnSelectedFile(fileToReformat);
-
-    checkFormationAndImportsOptimizationFor(Arrays.asList(fileToReformat));
-    checkNoProcessingWasPerformedOn(shouldNotBeFormatted);
-  }
-
-  public void testReformatAndOptimizeFileFromEditor() throws IOException {
-    List<PsiFile> files = createTestFiles(getTempRootDirectory(), classNames);
-    injectMockDialogFlags(new MockReformatFileSettings().setOptimizeImports(true));
-
-    PsiFile fileToFormat = files.get(0);
-    List<PsiFile> shouldNotBeFormatted = files.subList(1, files.size());
-
-    performReformatActionOnFileInEditor(fileToFormat);
-    checkFormationAndImportsOptimizationFor(Arrays.asList(fileToFormat));
-    checkNoProcessingWasPerformedOn(shouldNotBeFormatted);
-  }
-
   public void testOptimizeAndReformatOnlySelectedFiles() throws IOException {
     List<PsiFile> files = createTestFiles(getTempRootDirectory(), classNames);
     List<PsiFile> forProcessing = ContainerUtil.newArrayList(files.get(0), files.get(1));
@@ -77,28 +52,6 @@ public class ReformatCodeActionTest extends AbstractLayoutCodeProcessorTest {
     checkNoProcessingWasPerformedOn(noProcessing);
   }
 
-  public void testOptimizeAndReformatAllFilesInDirectoryIncludeSubdirs() throws IOException {
-    TestFileStructure fileStructure = getThreeLevelDirectoryStructure();
-    injectMockDialogFlags(new MockReformatFileSettings().setOptimizeImports(true).setProcessDirectory(true).setIncludeSubdirs(true));
-    PsiFile fileInEditor = fileStructure.getFilesAtLevel(2).get(0);
-    List<PsiFile> shouldNotBeFormatted = fileStructure.getFilesAtLevel(1);
-
-    performReformatActionOnFileInEditor(fileInEditor);
-
-    checkFormationAndImportsOptimizationFor(fileStructure.getFilesAtLevel(2), fileStructure.getFilesAtLevel(3));
-    checkNoProcessingWasPerformedOn(shouldNotBeFormatted);
-  }
-
-  public void testOptimizeAndReformatAllFilesInDirectoryExcludeSubdirs() throws IOException {
-    TestFileStructure fileStructure = getThreeLevelDirectoryStructure();
-    injectMockDialogFlags(new MockReformatFileSettings().setOptimizeImports(true).setIncludeSubdirs(false));
-
-    performReformatActionOnSelectedFiles(fileStructure.getFilesAtLevel(2));
-
-    checkFormationAndImportsOptimizationFor(fileStructure.getFilesAtLevel(2));
-    checkNoProcessingWasPerformedOn(fileStructure.getFilesAtLevel(1), fileStructure.getFilesAtLevel(3));
-  }
-
   public void testOptimizeAndReformatInModule() throws IOException {
     Module module = createModuleWithSourceRoot("newModule");
     VirtualFile srcDir = ModuleRootManager.getInstance(module).getSourceRoots()[0];
@@ -109,26 +62,4 @@ public class ReformatCodeActionTest extends AbstractLayoutCodeProcessorTest {
 
     checkFormationAndImportsOptimizationFor(files);
   }
-
-  private TestFileStructure getThreeLevelDirectoryStructure() throws IOException {
-    TestFileStructure fileStructure = new TestFileStructure(getModule(), getTempRootDirectory());
-
-    fileStructure.createDirectoryAndMakeItCurrent("dir");
-    addFilesToCurrentDirectory(fileStructure);
-
-    fileStructure.createDirectoryAndMakeItCurrent("innerDir");
-    addFilesToCurrentDirectory(fileStructure);
-
-    fileStructure.createDirectoryAndMakeItCurrent("innerInnerDir");
-    addFilesToCurrentDirectory(fileStructure);
-
-    return fileStructure;
-  }
-
-  private void addFilesToCurrentDirectory(TestFileStructure fileStructure) throws IOException {
-    for (int i = 0; i < 5; i++) {
-      String className = "Test" + i;
-      fileStructure.addTestFile("Test" + i + ".java", getUntouchedJavaSourceForTotalProcessing(className));
-    }
-  }
 }