*/
public void testSetTextBetweenAnchors() {
AnchorType bottomType = AnchorType.create(EditorTests.class, "bottom");
AnchorType topType = AnchorType.create(EditorTests.class, "top");
Document doc = Document.createFromString("qwerty\nasdfgh\nzxcvbn\n");
LineFinder lineFinder = doc.getLineFinder();
AnchorManager anchorManager = doc.getAnchorManager();
LineInfo lineInfo = lineFinder.findLine(1);
Editor editor = Editor.create(new MockAppContext());
editor.setDocument(doc);
Anchor topAnchor = anchorManager.createAnchor(topType, lineInfo.line(), lineInfo.number(),
AnchorManager.IGNORE_COLUMN);
topAnchor.setRemovalStrategy(Anchor.RemovalStrategy.SHIFT);
topAnchor.setInsertionPlacementStrategy(InsertionPlacementStrategy.EARLIER);
Anchor bottomAnchor = anchorManager.createAnchor(bottomType, lineInfo.line(), lineInfo.number(),
AnchorManager.IGNORE_COLUMN);
bottomAnchor.setRemovalStrategy(Anchor.RemovalStrategy.SHIFT);
bottomAnchor.setInsertionPlacementStrategy(InsertionPlacementStrategy.LATER);
SelectionModel selection = editor.getSelection();
selection.setSelection(lineInfo, 1, lineInfo, 4);
AnchorUtils.setTextBetweenAnchors(
"bugaga", topAnchor, bottomAnchor, editor.getEditorDocumentMutator());
assertEquals("qwerty\nbugaga\nzxcvbn\n", doc.asText());
}