summaryrefslogtreecommitdiff
path: root/java/java-tests/testSrc/com/intellij/psi/impl
diff options
context:
space:
mode:
Diffstat (limited to 'java/java-tests/testSrc/com/intellij/psi/impl')
-rw-r--r--java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/ClassFileUnderSourceRootTest.java (renamed from java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/SCR17650Test.java)15
-rw-r--r--java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/FindClassTest.java (renamed from java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/SCR14423Test.java)37
-rw-r--r--java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/SameSourceRootInTwoModulesTest.java (renamed from java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/SCR20733Test.java)9
-rw-r--r--java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/SourceRootAddedAsLibraryRootTest.java (renamed from java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/SCR19174Test.java)15
-rw-r--r--java/java-tests/testSrc/com/intellij/psi/impl/file/impl/PsiEventsTest.java89
-rw-r--r--java/java-tests/testSrc/com/intellij/psi/impl/file/impl/TempFileSystemTest.java43
6 files changed, 107 insertions, 101 deletions
diff --git a/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/SCR17650Test.java b/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/ClassFileUnderSourceRootTest.java
index 187d0c2ad80e..5311bd15dfec 100644
--- a/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/SCR17650Test.java
+++ b/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/ClassFileUnderSourceRootTest.java
@@ -3,7 +3,6 @@ package com.intellij.psi.impl.cache.impl;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ex.PathManagerEx;
import com.intellij.openapi.roots.ModuleRootModificationUtil;
-import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VfsUtilCore;
@@ -17,20 +16,15 @@ import java.io.IOException;
/**
* @author max
*/
-public class SCR17650Test extends PsiTestCase {
+public class ClassFileUnderSourceRootTest extends PsiTestCase {
private static final String TEST_ROOT = PathManagerEx.getTestDataPath() + "/psi/repositoryUse/cls";
-
private VirtualFile myDir;
@Override
protected void setUp() throws Exception {
super.setUp();
- final File root = FileUtil.createTempFile(getName(), "");
- root.delete();
- root.mkdir();
- myFilesToDelete.add(root);
-
+ final File root = createTempDirectory();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
@@ -55,11 +49,10 @@ public class SCR17650Test extends PsiTestCase {
private static VirtualFile getClassFile() {
VirtualFile vDir = LocalFileSystem.getInstance().findFileByPath(TEST_ROOT.replace(File.separatorChar, '/'));
- VirtualFile child = vDir.findChild("pack").findChild("MyClass.class");
- return child;
+ return vDir.findFileByRelativePath("pack/MyClass.class");
}
- public void test17650() throws Exception {
+ public void testFindClass() throws Exception {
assertEquals("p.A", myJavaFacade.findClass("p.A").getQualifiedName());
assertEquals("pack.MyClass", myJavaFacade.findClass("pack.MyClass").getQualifiedName());
}
diff --git a/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/SCR14423Test.java b/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/FindClassTest.java
index 2870108623b1..e88027409dc0 100644
--- a/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/SCR14423Test.java
+++ b/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/FindClassTest.java
@@ -18,11 +18,11 @@ package com.intellij.psi.impl.cache.impl;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.fileEditor.FileDocumentManager;
+import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.roots.ContentEntry;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.ModuleRootModificationUtil;
-import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
@@ -37,7 +37,7 @@ import java.io.IOException;
/**
* @author max
*/
-public class SCR14423Test extends PsiTestCase {
+public class FindClassTest extends PsiTestCase {
private VirtualFile myPrjDir1;
private VirtualFile mySrcDir1;
private VirtualFile myPackDir;
@@ -46,11 +46,7 @@ public class SCR14423Test extends PsiTestCase {
protected void setUp() throws Exception {
super.setUp();
- final File root = FileUtil.createTempFile(getName(), "");
- root.delete();
- root.mkdir();
- myFilesToDelete.add(root);
-
+ final File root = createTempDirectory();
WriteCommandAction.runWriteCommandAction(null, new Runnable() {
@Override
public void run() {
@@ -75,14 +71,12 @@ public class SCR14423Test extends PsiTestCase {
});
}
- public void testBug2() throws Exception {
+ public void testSimple() throws Exception {
PsiClass psiClass = myJavaFacade.findClass("p.A");
assertEquals("p.A", psiClass.getQualifiedName());
-
- testBug1();
}
- public void testBug1() {
+ public void testClassUnderExcludedFolder() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
PsiTestUtil.addExcludedRoot(myModule, myPackDir);
@@ -101,7 +95,7 @@ public class SCR14423Test extends PsiTestCase {
});
}
- public void testBug3() {
+ public void testClassUnderIgnoredFolder() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
PsiClass psiClass = myJavaFacade.findClass("p.A", GlobalSearchScope.allScope(myProject));
@@ -109,14 +103,15 @@ public class SCR14423Test extends PsiTestCase {
assertTrue(psiClass.isValid());
- PsiTestUtil.addExcludedRoot(myModule, myPackDir);
-
- assertFalse(psiClass.isValid());
-
- ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule).getModifiableModel();
- final ContentEntry content = rootModel.getContentEntries()[0];
- content.removeExcludeFolder(content.getExcludeFolders()[0]);
- rootModel.commit();
+ FileTypeManager fileTypeManager = FileTypeManager.getInstance();
+ String ignoredFilesList = fileTypeManager.getIgnoredFilesList();
+ fileTypeManager.setIgnoredFilesList(ignoredFilesList + ";p");
+ try {
+ assertFalse(psiClass.isValid());
+ }
+ finally {
+ fileTypeManager.setIgnoredFilesList(ignoredFilesList);
+ }
psiClass = myJavaFacade.findClass("p.A");
assertTrue(psiClass.isValid());
@@ -124,7 +119,7 @@ public class SCR14423Test extends PsiTestCase {
});
}
- public void testSyncrhonizationAfterChange() {
+ public void testSynchronizationAfterChange() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
FileDocumentManager.getInstance().saveAllDocuments();
diff --git a/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/SCR20733Test.java b/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/SameSourceRootInTwoModulesTest.java
index 5fef7daea7d9..1a5d5faeca7c 100644
--- a/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/SCR20733Test.java
+++ b/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/SameSourceRootInTwoModulesTest.java
@@ -3,7 +3,6 @@ package com.intellij.psi.impl.cache.impl;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil;
-import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
@@ -18,7 +17,7 @@ import java.io.IOException;
/**
* @author max
*/
-public class SCR20733Test extends PsiTestCase {
+public class SameSourceRootInTwoModulesTest extends PsiTestCase {
private VirtualFile myPrjDir1;
private VirtualFile mySrcDir1;
private VirtualFile myPackDir;
@@ -27,11 +26,7 @@ public class SCR20733Test extends PsiTestCase {
protected void setUp() throws Exception {
super.setUp();
- final File root = FileUtil.createTempFile(getName(), "");
- root.delete();
- root.mkdir();
- myFilesToDelete.add(root);
-
+ final File root = createTempDirectory();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
diff --git a/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/SCR19174Test.java b/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/SourceRootAddedAsLibraryRootTest.java
index c47bbf7184e8..36baf5de0d76 100644
--- a/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/SCR19174Test.java
+++ b/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/SourceRootAddedAsLibraryRootTest.java
@@ -2,7 +2,6 @@ package com.intellij.psi.impl.cache.impl;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.roots.ModuleRootModificationUtil;
-import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
@@ -16,7 +15,7 @@ import java.io.IOException;
/**
* @author max
*/
-public class SCR19174Test extends PsiTestCase {
+public class SourceRootAddedAsLibraryRootTest extends PsiTestCase {
private VirtualFile myDir;
private VirtualFile myVFile;
@@ -24,11 +23,7 @@ public class SCR19174Test extends PsiTestCase {
protected void setUp() throws Exception {
super.setUp();
- final File root = FileUtil.createTempFile(getName(), "");
- root.delete();
- root.mkdir();
- myFilesToDelete.add(root);
-
+ final File root = createTempDirectory();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
@@ -37,12 +32,6 @@ public class SCR19174Test extends PsiTestCase {
myDir = rootVFile.createChildDirectory(null, "contentAndLibrary");
- /*
- myVFile = myDir.createChildData(null, "A.java");
- Writer writer1 = myVFile.getWriter(null);
- writer1.write("package p; public class A{ public void foo(); }");
- writer1.close();
- */
PsiTestUtil.addSourceRoot(myModule, myDir);
}
catch (IOException e) {
diff --git a/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/PsiEventsTest.java b/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/PsiEventsTest.java
index 2461a4601eba..a933d5bcacf6 100644
--- a/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/PsiEventsTest.java
+++ b/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/PsiEventsTest.java
@@ -43,13 +43,11 @@ public class PsiEventsTest extends PsiTestCase {
private VirtualFile myPrjDir1;
private VirtualFile myPrjDir2;
- private VirtualFile myPrjDir3;
private VirtualFile mySrcDir1;
private VirtualFile mySrcDir2;
private VirtualFile mySrcDir3;
- private VirtualFile mySrcDir4;
private VirtualFile myClsDir1;
- private VirtualFile myExcludedDir1;
+ private VirtualFile myIgnoredDir;
@Override
protected void setUp() throws Exception {
@@ -76,13 +74,12 @@ public class PsiEventsTest extends PsiTestCase {
myClsDir1 = myPrjDir1.createChildDirectory(null, "cls1");
- myExcludedDir1 = mySrcDir1.createChildDirectory(null, "excluded");
+ myIgnoredDir = mySrcDir1.createChildDirectory(null, "CVS");
PsiTestUtil.addContentRoot(myModule, myPrjDir1);
PsiTestUtil.addSourceRoot(myModule, mySrcDir1);
PsiTestUtil.addSourceRoot(myModule, mySrcDir2);
PsiTestUtil.addContentRoot(myModule, myPrjDir2);
- PsiTestUtil.addExcludedRoot(myModule, myExcludedDir1);
ModuleRootModificationUtil.addModuleLibrary(myModule, myClsDir1.getUrl());
PsiTestUtil.addSourceRoot(myModule, mySrcDir3);
} catch (IOException e) {
@@ -106,7 +103,7 @@ public class PsiEventsTest extends PsiTestCase {
String expected =
"beforeChildAddition\n" +
"childAdded\n";
- assertEquals(expected, string);
+ assertEquals(psiDir.getName(), expected, string);
}
public void testCreateDirectory() throws Exception {
@@ -121,7 +118,7 @@ public class PsiEventsTest extends PsiTestCase {
String expected =
"beforeChildAddition\n" +
"childAdded\n";
- assertEquals(expected, string);
+ assertEquals(psiDir.getName(), expected, string);
}
public void testDeleteFile() throws Exception {
@@ -139,7 +136,7 @@ public class PsiEventsTest extends PsiTestCase {
String expected =
"beforeChildRemoval\n" +
"childRemoved\n";
- assertEquals(expected, string);
+ assertEquals(psiFile.getName(), expected, string);
}
public void testDeleteDirectory() throws Exception {
@@ -157,10 +154,10 @@ public class PsiEventsTest extends PsiTestCase {
String expected =
"beforeChildRemoval\n" +
"childRemoved\n";
- assertEquals(expected, string);
+ assertEquals(psiDirectory.getName(), expected, string);
}
- public void testRenameFile1() throws Exception {
+ public void testRenameFile() throws Exception {
FileManager fileManager = myPsiManager.getFileManager();
VirtualFile file = myPrjDir1.createChildData(null, "a.txt");
PsiFile psiFile = fileManager.findFile(file);
@@ -174,10 +171,10 @@ public class PsiEventsTest extends PsiTestCase {
String expected =
"beforePropertyChange\n" +
"propertyChanged\n";
- assertEquals(expected, string);
+ assertEquals(psiFile.getName(), expected, string);
}
- public void testRenameFile2() throws Exception {
+ public void testRenameFileChangingExtension() throws Exception {
FileManager fileManager = myPsiManager.getFileManager();
VirtualFile file = myPrjDir1.createChildData(null, "a.txt");
PsiFile psiFile = fileManager.findFile(file);
@@ -191,10 +188,10 @@ public class PsiEventsTest extends PsiTestCase {
String expected =
"beforeChildReplacement\n" +
"childReplaced\n";
- assertEquals(expected, string);
+ assertEquals(psiFile.getName(), expected, string);
}
- public void testRenameFile3() throws Exception {
+ public void testRenameFileToIgnored() throws Exception {
FileManager fileManager = myPsiManager.getFileManager();
VirtualFile file = myPrjDir1.createChildData(null, "a.txt");
PsiFile psiFile = fileManager.findFile(file);
@@ -208,11 +205,11 @@ public class PsiEventsTest extends PsiTestCase {
String expected =
"beforeChildRemoval\n" +
"childRemoved\n";
- assertEquals(expected, string);
+ assertEquals(psiFile.getName(), expected, string);
assertNull(fileManager.findFile(file));
}
- public void testRenameFile4() throws Exception {
+ public void testRenameFileFromIgnored() throws Exception {
FileManager fileManager = myPsiManager.getFileManager();
VirtualFile file = myPrjDir1.createChildData(null, "CVS");
PsiDirectory psiDirectory = fileManager.findDirectory(file.getParent());
@@ -226,10 +223,10 @@ public class PsiEventsTest extends PsiTestCase {
String expected =
"beforeChildAddition\n" +
"childAdded\n";
- assertEquals(expected, string);
+ assertEquals(psiDirectory.getName(), expected, string);
}
- public void testRenameDirectory1() throws Exception {
+ public void testRenameDirectory() throws Exception {
FileManager fileManager = myPsiManager.getFileManager();
VirtualFile file = myPrjDir1.createChildDirectory(null, "dir1");
PsiDirectory psiDirectory = fileManager.findDirectory(file);
@@ -243,10 +240,10 @@ public class PsiEventsTest extends PsiTestCase {
String expected =
"beforePropertyChange\n" +
"propertyChanged\n";
- assertEquals(expected, string);
+ assertEquals(psiDirectory.getName(), expected, string);
}
- public void testRenameDirectory2() throws Exception {
+ public void testRenameDirectoryToIgnored() throws Exception {
FileManager fileManager = myPsiManager.getFileManager();
VirtualFile file = myPrjDir1.createChildDirectory(null, "dir1");
PsiDirectory psiDirectory = fileManager.findDirectory(file);
@@ -260,11 +257,11 @@ public class PsiEventsTest extends PsiTestCase {
String expected =
"beforeChildRemoval\n" +
"childRemoved\n";
- assertEquals(expected, string);
+ assertEquals(psiDirectory.getName(), expected, string);
assertNull(fileManager.findDirectory(file));
}
- public void testRenameDirectory3() throws Exception {
+ public void testRenameDirectoryFromIgnored() throws Exception {
FileManager fileManager = myPsiManager.getFileManager();
VirtualFile file = myPrjDir1.createChildDirectory(null, "CVS");
PsiDirectory psiDirectory = fileManager.findDirectory(file.getParent());
@@ -278,7 +275,7 @@ public class PsiEventsTest extends PsiTestCase {
String expected =
"beforeChildAddition\n" +
"childAdded\n";
- assertEquals(expected, string);
+ assertEquals(psiDirectory.getName(), expected, string);
}
public void testMakeFileReadOnly() throws Exception {
@@ -291,7 +288,6 @@ public class PsiEventsTest extends PsiTestCase {
ReadOnlyAttributeUtil.setReadOnlyAttribute(file, true);
- String string = listener.getEventsString();
final String expected =
"beforePropertyChange\n" +
"propertyChanged\n";
@@ -306,7 +302,7 @@ public class PsiEventsTest extends PsiTestCase {
ReadOnlyAttributeUtil.setReadOnlyAttribute(file, false);
}
- public void testMoveFile1() throws Exception {
+ public void testMoveFile() throws Exception {
FileManager fileManager = myPsiManager.getFileManager();
VirtualFile file = myPrjDir1.createChildData(null, "a.txt");
PsiFile psiFile = fileManager.findFile(file);
@@ -320,10 +316,10 @@ public class PsiEventsTest extends PsiTestCase {
String expected =
"beforeChildMovement\n" +
"childMoved\n";
- assertEquals(expected, string);
+ assertEquals(psiFile.getName(), expected, string);
}
- public void testMoveFile2() throws Exception {
+ public void testMoveFileToIgnoredDir() throws Exception {
FileManager fileManager = myPsiManager.getFileManager();
VirtualFile file = myPrjDir1.createChildData(null, "a.txt");
PsiFile psiFile = fileManager.findFile(file);
@@ -331,19 +327,18 @@ public class PsiEventsTest extends PsiTestCase {
EventsTestListener listener = new EventsTestListener();
myPsiManager.addPsiTreeChangeListener(listener,getTestRootDisposable());
- file.move(null, myExcludedDir1);
+ file.move(null, myIgnoredDir);
String string = listener.getEventsString();
String expected =
"beforeChildRemoval\n" +
"childRemoved\n";
- assertEquals(expected, string);
+ assertEquals(psiFile.getName(), expected, string);
assertNull(fileManager.findFile(file));
}
- public void testMoveFile3() throws Exception {
- FileManager fileManager = myPsiManager.getFileManager();
- VirtualFile file = myExcludedDir1.createChildData(null, "a.txt");
+ public void testMoveFileFromIgnoredDir() throws Exception {
+ VirtualFile file = myIgnoredDir.createChildData(null, "a.txt");
EventsTestListener listener = new EventsTestListener();
myPsiManager.addPsiTreeChangeListener(listener,getTestRootDisposable());
@@ -357,10 +352,9 @@ public class PsiEventsTest extends PsiTestCase {
assertEquals(expected, string);
}
- public void testMoveFile4() throws Exception {
- FileManager fileManager = myPsiManager.getFileManager();
- VirtualFile file = myExcludedDir1.createChildData(null, "a.txt");
- VirtualFile subdir = myExcludedDir1.createChildDirectory(null, "subdir");
+ public void testMoveFileInsideIgnoredDir() throws Exception {
+ VirtualFile file = myIgnoredDir.createChildData(null, "a.txt");
+ VirtualFile subdir = myIgnoredDir.createChildDirectory(null, "subdir");
EventsTestListener listener = new EventsTestListener();
myPsiManager.addPsiTreeChangeListener(listener,getTestRootDisposable());
@@ -372,7 +366,7 @@ public class PsiEventsTest extends PsiTestCase {
assertEquals(expected, string);
}
- public void testMoveDirectory1() throws Exception {
+ public void testMoveDirectory() throws Exception {
FileManager fileManager = myPsiManager.getFileManager();
VirtualFile file = myPrjDir1.createChildDirectory(null, "dir");
PsiDirectory psiDirectory = fileManager.findDirectory(file);
@@ -386,10 +380,10 @@ public class PsiEventsTest extends PsiTestCase {
String expected =
"beforeChildMovement\n" +
"childMoved\n";
- assertEquals(expected, string);
+ assertEquals(psiDirectory.getName(), expected, string);
}
- public void testMoveDirectory2() throws Exception {
+ public void testMoveDirectoryToIgnored() throws Exception {
FileManager fileManager = myPsiManager.getFileManager();
VirtualFile file = myPrjDir1.createChildDirectory(null, "dir");
PsiDirectory psiDirectory = fileManager.findDirectory(file);
@@ -397,19 +391,18 @@ public class PsiEventsTest extends PsiTestCase {
EventsTestListener listener = new EventsTestListener();
myPsiManager.addPsiTreeChangeListener(listener,getTestRootDisposable());
- file.move(null, myExcludedDir1);
+ file.move(null, myIgnoredDir);
String string = listener.getEventsString();
String expected =
"beforeChildRemoval\n" +
"childRemoved\n";
- assertEquals(expected, string);
+ assertEquals(psiDirectory.getName(), expected, string);
assertNull(fileManager.findDirectory(file));
}
- public void testMoveDirectory3() throws Exception {
- FileManager fileManager = myPsiManager.getFileManager();
- VirtualFile file = myExcludedDir1.createChildDirectory(null, "dir");
+ public void testMoveDirectoryFromIgnored() throws Exception {
+ VirtualFile file = myIgnoredDir.createChildDirectory(null, "dir");
EventsTestListener listener = new EventsTestListener();
myPsiManager.addPsiTreeChangeListener(listener,getTestRootDisposable());
@@ -423,10 +416,9 @@ public class PsiEventsTest extends PsiTestCase {
assertEquals(expected, string);
}
- public void testMoveDirectory4() throws Exception {
- FileManager fileManager = myPsiManager.getFileManager();
- VirtualFile file = myExcludedDir1.createChildDirectory(null, "dir");
- VirtualFile subdir = myExcludedDir1.createChildDirectory(null, "subdir");
+ public void testMoveDirectoryInsideIgnored() throws Exception {
+ VirtualFile file = myIgnoredDir.createChildDirectory(null, "dir");
+ VirtualFile subdir = myIgnoredDir.createChildDirectory(null, "subdir");
EventsTestListener listener = new EventsTestListener();
myPsiManager.addPsiTreeChangeListener(listener,getTestRootDisposable());
@@ -497,7 +489,6 @@ public class PsiEventsTest extends PsiTestCase {
}
public void testModifyFileTypes() throws Exception {
- FileManager fileManager = myPsiManager.getFileManager();
EventsTestListener listener = new EventsTestListener();
myPsiManager.addPsiTreeChangeListener(listener,getTestRootDisposable());
diff --git a/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/TempFileSystemTest.java b/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/TempFileSystemTest.java
new file mode 100644
index 000000000000..dbdd61bc340b
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/TempFileSystemTest.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.psi.impl.file.impl;
+
+import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiDirectory;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiManager;
+import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
+
+import java.io.IOException;
+
+public class TempFileSystemTest extends LightPlatformCodeInsightFixtureTestCase {
+ public void testMove() {
+ ProjectRootManager rootManager = ProjectRootManager.getInstance(getProject());
+ VirtualFile sourceRoot = rootManager.getContentSourceRoots()[0];
+ PsiManager psiManager = PsiManager.getInstance(getProject());
+ PsiDirectory psiSourceRoot = psiManager.findDirectory(sourceRoot);
+ PsiFile psiFile = psiSourceRoot.createFile("TestDocument.xml");
+ try {
+ psiFile.getVirtualFile().move(this, psiSourceRoot.createSubdirectory("com").getVirtualFile());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ assertTrue(psiFile.isValid());
+ psiFile.delete();
+ assertFalse(psiFile.isValid());
+ }
+} \ No newline at end of file