void (@NotNull Document document) { WriteCommandAction.runWriteCommandAction(getProject(), () -> { try { file.getFirstChild().delete(); fail("Must not modify PSI inside save listener"); } catch (IncorrectOperationException e) { assertEquals("Must not modify PSI inside save listener", e.getMessage()); } }); }