assertThat(delete.getNodeToDelete(), is(methodInvocation));
}
@Test
public void movedNodeShouldProduceMoveOperation() throws Exception {
Node methodInvocation = addToLeft(METHOD_INVOCATION, "foo.bar();");
Node ifStatementLeft = addToLeft(JavaEntityType.IF_STATEMENT, "foo != null");
addToNode(ifStatementLeft, ASSIGNMENT, "b = a;");
Node ifStatementRight = addToRight(JavaEntityType.IF_STATEMENT, "foo != null");
addToNode(ifStatementRight, METHOD_INVOCATION, "foo.bar();");
addToNode(ifStatementRight, ASSIGNMENT, "b = a;");
createEditScript();
assertThat(fEditScript.size(), is(1));
TreeEditOperation operation = fEditScript.get(0);
assertThat(operation.getOperationType(), is(OperationType.MOVE));
MoveOperation move = (MoveOperation) operation;
assertThat(move.getOldParent(), is(fRootLeft));
assertThat(move.getNewParent().getLabel(), is(ifStatementRight.getLabel()));
assertThat(move.getNewParent().getValue(), is(ifStatementRight.getValue()));
assertThat(move.getNodeToMove(), is(methodInvocation));
assertThat(move.getNewNode().getLabel(), is(methodInvocation.getLabel()));
assertThat(move.getNewNode().getValue(), is(methodInvocation.getValue()));
}