void () { final MockVirtualFile file = new MockVirtualFile("test.txt", "test\rtest") { @Override public void refresh(boolean asynchronous, boolean recursive, Runnable postRunnable) { long oldStamp = getModificationStamp(); setModificationStamp(LocalTimeCounter.currentTime()); myDocumentManager.contentsChanged(new VFileContentChangeEvent(null, this, oldStamp, getModificationStamp())); } }; Document document = myDocumentManager.getDocument(file); assertNotNull(file.toString(), document); document.insertString(0, "zzz"); file.setContent(null, "xxx", false); myAskReloadFromDiskResult = Boolean.TRUE; myDocumentManager.saveAllDocuments(); long fileStamp = file.getModificationStamp(); assertEquals("xxx", document.getText()); assertEquals(file.getModificationStamp(), document.getModificationStamp()); assertEquals(file.getModificationStamp(), fileStamp); assertEquals(0, myDocumentManager.getUnsavedDocuments().length); }