void (@NotNull File expectedFile, @NotNull Editor editor, Boolean enableSelectionTags) { Caret caret = editor.getCaretModel().getCurrentCaret(); List<TagsTestDataUtil.TagInfo> tags = Lists.newArrayList( new TagsTestDataUtil.TagInfo<>(caret.getOffset(), true, "caret") ); if (enableSelectionTags) { int selectionStart = caret.getSelectionStart(); int selectionEnd = caret.getSelectionEnd(); tags.add(new TagsTestDataUtil.TagInfo<>(selectionStart, true, "selection")); tags.add(new TagsTestDataUtil.TagInfo<>(selectionEnd, false, "selection")); } String afterText = TagsTestDataUtil.insertTagsInText(tags, editor.getDocument().getText(), (TagsTestDataUtil.TagInfo t) -> null); assertEqualsToFile(expectedFile, afterText); }