void () { ApplicationManager.getApplication().runWriteAction(() -> { FileDocumentManager.getInstance().saveAllDocuments(); PsiClass psiClass = myJavaFacade.findClass("p.A"); final VirtualFile vFile = psiClass.getContainingFile().getVirtualFile(); File ioFile = VfsUtilCore.virtualToIoFile(vFile); ioFile.setLastModified(5); LocalFileSystem.getInstance().refresh(false); ModuleRootModificationUtil.setModuleSdk(myModule, null); psiClass = myJavaFacade.findClass("p.A"); assertNotNull(psiClass); }); }