void (@NotNull Project project, @NotNull final VirtualFile file, @NotNull final String newContent) { assertTrue(file.isValid()); file.getTimeStamp(); WriteCommandAction.writeCommandAction(project) .withName("VcsTestUtil EditFileInCommand") //NON-NLS .run(() -> { try { final long newTs = Math.max(System.currentTimeMillis(), file.getTimeStamp() + 1100); file.setBinaryContent(newContent.getBytes(StandardCharsets.UTF_8), -1, newTs); final File file1 = new File(file.getPath()); FileUtil.writeToFile(file1, newContent.getBytes(StandardCharsets.UTF_8)); file.refresh(false, false); assertTrue(file1 + " / " + newTs, file1.setLastModified(newTs)); } catch (IOException ex) { throw new RuntimeException(ex); } }); }