void () { @Language("JAVA") @NonNls String text = """ public class Test { public void test() { int i = 1; } }"""; init(text, PlainTextFileType.INSTANCE); addBookmark(2); List<Bookmark> bookmarksBefore = getManager().getBookmarks(); assertEquals(1, bookmarksBefore.size()); WriteCommandAction.writeCommandAction(getProject()).run(() -> getEditor().getDocument().setText(text)); List<Bookmark> bookmarksAfter = getManager().getBookmarks(); assertEquals(1, bookmarksAfter.size()); assertSame(bookmarksBefore.get(0), bookmarksAfter.get(0)); for (Bookmark bookmark : bookmarksAfter) { checkBookmarkNavigation(bookmark); } }