Search in sources :

Example 1 with PersistentFSImpl

use of com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl in project intellij-community by JetBrains.

the class LocalFileSystemTest method testFileLength.

public void testFileLength() throws Exception {
    File file = FileUtil.createTempFile("test", "txt");
    FileUtil.writeToFile(file, "hello");
    VirtualFile virtualFile = myFS.refreshAndFindFileByIoFile(file);
    assertNotNull(virtualFile);
    String s = VfsUtilCore.loadText(virtualFile);
    assertEquals("hello", s);
    assertEquals(5, virtualFile.getLength());
    FileUtil.writeToFile(file, "new content");
    ((PersistentFSImpl) PersistentFS.getInstance()).cleanPersistedContents();
    s = VfsUtilCore.loadText(virtualFile);
    assertEquals("new content", s);
    assertEquals(11, virtualFile.getLength());
}
Also used : PersistentFSImpl(com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl) File(java.io.File)

Aggregations

PersistentFSImpl (com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl)1 File (java.io.File)1