void () { @Language("JAVA") @NonNls String text = """ public class Test { public void test() { int i = 1; } }"""; init(text, PlainTextFileType.INSTANCE); addBookmark(2); assertEquals(1, getManager().getBookmarks().size()); WriteCommandAction.writeCommandAction(getProject()).run(() -> getEditor().getDocument().setText("111\n222" + text + "333")); List<Bookmark> bookmarks = getManager().getBookmarks(); assertEquals(1, bookmarks.size()); Bookmark bookmark = bookmarks.get(0); assertEquals(3, ((LineBookmark)bookmark).getLine()); checkBookmarkNavigation(bookmark); }