Examples of TreeEditOperation


Examples of ch.uzh.ifi.seal.changedistiller.treedifferencing.TreeEditOperation

    @Test
    public void insertedNodeShouldProduceInsertOperation() throws Exception {
        Node methodInvocation = addToRight(METHOD_INVOCATION, "foo.bar();");
        createEditScript();
        assertThat(fEditScript.size(), is(1));
        TreeEditOperation operation = fEditScript.get(0);
        assertThat(operation.getOperationType(), is(OperationType.INSERT));
        InsertOperation insert = (InsertOperation) operation;
        assertThat(insert.getParentNode(), is(fRootLeft));
        assertThat(insert.getNodeToInsert().getLabel(), is(methodInvocation.getLabel()));
        assertThat(insert.getNodeToInsert().getValue(), is(methodInvocation.getValue()));
    }
View Full Code Here

Examples of ch.uzh.ifi.seal.changedistiller.treedifferencing.TreeEditOperation

    @Test
    public void deletedNodeShouldProduceDeleteOperation() throws Exception {
        Node methodInvocation = addToLeft(METHOD_INVOCATION, "foo.bar();");
        createEditScript();
        assertThat(fEditScript.size(), is(1));
        TreeEditOperation operation = fEditScript.get(0);
        assertThat(operation.getOperationType(), is(OperationType.DELETE));
        DeleteOperation delete = (DeleteOperation) operation;
        assertThat(delete.getParentNode(), is(fRootLeft));
        assertThat(delete.getNodeToDelete(), is(methodInvocation));
    }
View Full Code Here

Examples of ch.uzh.ifi.seal.changedistiller.treedifferencing.TreeEditOperation

        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));
View Full Code Here

Examples of ch.uzh.ifi.seal.changedistiller.treedifferencing.TreeEditOperation

    public void changedNodeShouldProduceUpdateOperation() throws Exception {
        Node methodInvocationLeft = addToLeft(METHOD_INVOCATION, "foo.bar();");
        Node methodInvocationRight = addToRight(METHOD_INVOCATION, "foo.beer();");
        createEditScript();
        assertThat(fEditScript.size(), is(1));
        TreeEditOperation operation = fEditScript.get(0);
        assertThat(operation.getOperationType(), is(OperationType.UPDATE));
        UpdateOperation update = (UpdateOperation) operation;
        assertThat(update.getNodeToUpdate(), is(methodInvocationLeft));
        assertThat(update.getNewNode(), is(methodInvocationRight));
        assertThat(update.getOldValue(), is("foo.bar();"));
View Full Code Here

Examples of ch.uzh.ifi.seal.changedistiller.treedifferencing.TreeEditOperation

    Node innerTryRight = addToNode(outerTryRight,
        JavaEntityType.TRY_STATEMENT, "");
    createEditScript();
   
    assertThat(fEditScript.size(), is(2));
    TreeEditOperation firstOperation = fEditScript.get(0);
    assertThat(firstOperation.getOperationType(), is(OperationType.INSERT));
    InsertOperation firstInsert = (InsertOperation) firstOperation;
    assertThat(firstInsert.getNodeToInsert().getLabel(), is(outerTryRight.getLabel()));
    assertThat(firstInsert.getNodeToInsert().getValue(), is(outerTryRight.getValue()));

    TreeEditOperation secondOperation = fEditScript.get(1);
    assertThat(secondOperation.getOperationType(), is(OperationType.INSERT));
    InsertOperation insert = (InsertOperation) secondOperation;
    assertThat(insert.getNodeToInsert().getLabel(), is(innerTryRight.getLabel()));
    assertThat(insert.getNodeToInsert().getValue(), is(innerTryRight.getValue()));
   
    assertThat(((Node)insert.getNodeToInsert().getParent()).getLabel(), is(innerTryRight.getLabel()));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.