Package ch.uzh.ifi.seal.changedistiller.treedifferencing

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


    public void fieldDeclarationWithInitializerShouldBeConverted() throws Exception {
        fSnippet = "private String fField = \"aString\";";
        prepareCompilation();
        convertField("fField");
        assertThat(getTreeString(), is("fField {  { private },String,\"aString\" }"));
        Node initializer = getLastChild();
        assertThat(getSource(initializer), is("\"aString\""));
        assertThat(initializer.getLabel(), is(JavaEntityType.STRING_LITERAL));
    }
View Full Code Here


    public void fieldDeclarationWithTypeParameterShouldBeConverted() throws Exception {
        fSnippet = "List<String> fList;";
        prepareCompilation();
        convertField("fList");
        assertThat(getTreeString(), is("fList { ,List<String> }"));
        Node type = getFieldType();
        assertThat(getSource(type), is("List<String>"));
        assertThat(type.getLabel(), is(JavaEntityType.PARAMETERIZED_TYPE));
    }
View Full Code Here

    public void fieldDeclarationWithQualifiedTypeParameterShouldBeConverted() throws Exception {
        fSnippet = "List<Foo.Bar> fList;";
        prepareCompilation();
        convertField("fList");
        assertThat(getTreeString(), is("fList { ,List<Foo.Bar> }"));
        Node type = getFieldType();
        assertThat(getSource(type), is("List<Foo.Bar>"));
        assertThat(type.getLabel(), is(JavaEntityType.PARAMETERIZED_TYPE));
    }
View Full Code Here

    public void fieldDeclarationWithParameterizedQualifiedTypeParameterShouldBeConverted() throws Exception {
        fSnippet = "List<Foo<T>.Bar> fList;";
        prepareCompilation();
        convertField("fList");
        assertThat(getTreeString(), is("fList { ,List<Foo<T>.Bar> }"));
        Node type = getFieldType();
        assertThat(getSource(type), is("List<Foo<T>.Bar>"));
        assertThat(type.getLabel(), is(JavaEntityType.PARAMETERIZED_TYPE));
    }
View Full Code Here

    public void fieldDeclarationWithQualifiedParameterizedTypeParameterShouldBeConverted() throws Exception {
        fSnippet = "List<Foo.Bar<T>> fList;";
        prepareCompilation();
        convertField("fList");
        assertThat(getTreeString(), is("fList { ,List<Foo.Bar<T>> }"));
        Node type = getFieldType();
        assertThat(getSource(type), is("List<Foo.Bar<T>>"));
        assertThat(type.getLabel(), is(JavaEntityType.PARAMETERIZED_TYPE));
    }
View Full Code Here

                JavaEntityType.LINE_COMMENT);
    }

    @Test
    public void commentInsideBlockShouldBeAssociatedInside() throws Exception {
        Node node = findNode("a = (23 + Integer.parseInt(\"42\"));");
        assertCorrectAssociation(
                node,
                "/* A block comment" + LF + "             * with stars" + LF + "             */",
                JavaEntityType.BLOCK_COMMENT);
        node = findNode("b = Math.abs(number);");
View Full Code Here

        assertCorrectAssociation(node, "/* inside else */", JavaEntityType.BLOCK_COMMENT);
    }

    @Test
    public void commentInsideSimpleStatementShouldBeAssociatedToThatStatement() throws Exception {
        Node node = findNode("b = Math.round(Math.random());");
        assertCorrectAssociation(node, "/* inner comment */", JavaEntityType.BLOCK_COMMENT);
    }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    private Node findNode(String value) {
        for (Enumeration<Node> e = sRoot.breadthFirstEnumeration(); e.hasMoreElements();) {
            Node node = e.nextElement();
            if (node.getValue().equals(value)) {
                return node;
            }
        }
        return null;
    }
View Full Code Here

public class WhenNodesAreMatched extends WhenTreeNodesAreMatched {

    @Test
    public void unchangedNodesShouldMatch() throws Exception {
        Node whileStatementLeft = addToLeft(WHILE_STATEMENT, "i < length");
        Node whileStatementRight = addToRight(WHILE_STATEMENT, "i < length");
        addToNode(whileStatementLeft, METHOD_INVOCATION, "foo.bar();");
        addToNode(whileStatementLeft, ASSIGNMENT, "aInt = 24;");
        addToNode(whileStatementRight, METHOD_INVOCATION, "foo.bar();");
        addToNode(whileStatementRight, ASSIGNMENT, "aInt = 24;");
        createMatchSet();
View Full Code Here

        assertNodesAreMatched(whileStatementLeft, whileStatementRight);
    }

    @Test
    public void nodesWithDifferentLabelsShouldNotMatch() throws Exception {
        Node whileStatementLeft = addToLeft(WHILE_STATEMENT, "i < length");
        Node whileStatementRight = addToRight(FOR_STATEMENT, "i < length");
        addToNode(whileStatementLeft, METHOD_INVOCATION, "foo.bar();");
        addToNode(whileStatementLeft, ASSIGNMENT, "aInt = 24;");
        addToNode(whileStatementRight, METHOD_INVOCATION, "foo.bar();");
        addToNode(whileStatementRight, ASSIGNMENT, "aInt = 24;");
        createMatchSet();
View Full Code Here

TOP

Related Classes of ch.uzh.ifi.seal.changedistiller.treedifferencing.Node

Copyright © 2018 www.massapicom. 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.