use of org.eclipse.xtext.ui.tests.refactoring.MockRefactoringDocument.MockChange in project xtext-eclipse by eclipse.
the class UpdateAcceptorTest method testAddTextEdit.
@Test
public void testAddTextEdit() throws Exception {
updateAcceptor.accept(resourceURI0, new ReplaceEdit(0, 1, "foo"));
updateAcceptor.accept(resourceURI1, new ReplaceEdit(1, 2, "bar"));
updateAcceptor.accept(resourceURI0, new ReplaceEdit(3, 4, "baz"));
Change change = updateAcceptor.createCompositeChange(CHANGE_NAME, new NullProgressMonitor());
assertTrue(change instanceof CompositeChange);
Change[] children = ((CompositeChange) change).getChildren();
assertEquals(2, children.length);
assertTrue(children[0] instanceof MockChange);
MockChange change0 = (MockChange) children[0];
assertEquals(CHANGE_NAME, change0.getName());
assertTrue(children[1] instanceof MockChange);
MockChange change1 = (MockChange) children[1];
assertEquals(CHANGE_NAME, change1.getName());
assertTrue(change0.getTextEdit() instanceof MultiTextEdit);
assertTrue(change1.getTextEdit() instanceof MultiTextEdit);
assertEquals(3, ((MultiTextEdit) change0.getTextEdit()).getChildrenSize() + ((MultiTextEdit) change1.getTextEdit()).getChildrenSize());
}
Aggregations