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

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


    public void methodDeclarationWithQualifiedReturnTypeShouldBeConverted() throws Exception {
        fSnippet = "public org.Foo method() {}";
        prepareCompilation();
        convertMethod("method");
        assertThat(getTreeString(), is("method {  { public },method: org.Foo,,, }"));
        Node returnType = getReturnType();
        assertThat(getSource(returnType), is("org.Foo"));
        assertThat(returnType.getLabel(), is(JavaEntityType.QUALIFIED_TYPE));
    }
View Full Code Here


    public void methodDeclarationWithParameterizedReturnTypeShouldBeConverted() throws Exception {
        fSnippet = "List<String> method() {}";
        prepareCompilation();
        convertMethod("method");
        assertThat(getTreeString(), is("method { ,method: List<String>,,, }"));
        Node returnType = getReturnType();
        assertThat(getSource(returnType), is("List<String>"));
        assertThat(returnType.getLabel(), is(JavaEntityType.PARAMETERIZED_TYPE));
    }
View Full Code Here

    public void methodDeclarationWithOneParameterShouldBeConverted() throws Exception {
        fSnippet = "public void method(int anInteger) {}";
        prepareCompilation();
        convertMethod("method");
        assertThat(getTreeString(), is("method {  { public },method: void,, { anInteger { anInteger: int } }, }"));
        Node parameters = (Node) getLastChild().getPreviousSibling();
        assertThat(getSource(parameters), is("int anInteger"));
        assertThat(parameters.getLabel(), is(JavaEntityType.PARAMETERS));
        Node parameter = (Node) parameters.getFirstChild();
        assertThat(getSource(parameter), is("anInteger"));
        assertThat(parameter.getLabel(), is(JavaEntityType.PARAMETER));
        Node parameterType = (Node) parameters.getFirstLeaf();
        assertThat(getSource(parameterType), is("int"));
        assertThat(parameterType.getLabel(), is(JavaEntityType.SINGLE_TYPE));
    }
View Full Code Here

        prepareCompilation();
        convertMethod("method");
        assertThat(
                getTreeString(),
                is("method {  { public },method: void,, { anInteger { anInteger: int },aList { aList: List<String> } }, }"));
        Node parameters = (Node) getLastChild().getPreviousSibling();
        assertThat(getSource(parameters), is("int anInteger, List<String> aList"));
        assertThat(parameters.getLabel(), is(JavaEntityType.PARAMETERS));
        Node firstParameter = (Node) parameters.getFirstChild();
        assertThat(getSource(firstParameter), is("anInteger"));
        assertThat(firstParameter.getLabel(), is(JavaEntityType.PARAMETER));
        Node firstParameterType = (Node) parameters.getFirstLeaf();
        assertThat(getSource(firstParameterType), is("int"));
        assertThat(firstParameterType.getLabel(), is(JavaEntityType.SINGLE_TYPE));
        Node secondParameter = (Node) firstParameter.getNextSibling();
        assertThat(getSource(secondParameter), is("aList"));
        assertThat(secondParameter.getLabel(), is(JavaEntityType.PARAMETER));
        Node secondParameterType = (Node) secondParameter.getFirstLeaf();
        assertThat(getSource(secondParameterType), is("List<String>"));
        assertThat(secondParameterType.getLabel(), is(JavaEntityType.PARAMETERIZED_TYPE));
    }
View Full Code Here

    public void methodDeclarationWithTypeArgumentShouldBeConverted() throws Exception {
        fSnippet = "public <T> void method() {}";
        prepareCompilation();
        convertMethod("method");
        assertThat(getTreeString(), is("method {  { public },method: void, { T },, }"));
        Node typeArguments = (Node) getLastChild().getPreviousSibling().getPreviousSibling();
        assertThat(getSource(typeArguments), is("T"));
        assertThat(typeArguments.getLabel(), is(JavaEntityType.TYPE_PARAMETERS));
        Node typeArgument = (Node) typeArguments.getFirstLeaf();
        assertThat(getSource(typeArgument), is("T"));
        assertThat(typeArgument.getLabel(), is(JavaEntityType.TYPE_PARAMETER));
    }
View Full Code Here

    public void methodDeclarationWithMultipleTypeArgumentsShouldBeConverted() throws Exception {
        fSnippet = "public <T,U> void method() {}";
        prepareCompilation();
        convertMethod("method");
        assertThat(getTreeString(), is("method {  { public },method: void, { T,U },, }"));
        Node typeArguments = (Node) getLastChild().getPreviousSibling().getPreviousSibling();
        assertThat(getSource(typeArguments), is("T,U"));
        assertThat(typeArguments.getLabel(), is(JavaEntityType.TYPE_PARAMETERS));
        Node firstTypeArgument = (Node) typeArguments.getFirstLeaf();
        assertThat(getSource(firstTypeArgument), is("T"));
        assertThat(firstTypeArgument.getLabel(), is(JavaEntityType.TYPE_PARAMETER));
        Node secondTypeArgument = (Node) firstTypeArgument.getNextSibling();
        assertThat(getSource(secondTypeArgument), is("U"));
        assertThat(secondTypeArgument.getLabel(), is(JavaEntityType.TYPE_PARAMETER));
    }
View Full Code Here

    public void methodDeclarationWithBoundedTypeArgumentShouldBeConverted() throws Exception {
        fSnippet = "public <T extends Number> void method() {}";
        prepareCompilation();
        convertMethod("method");
        assertThat(getTreeString(), is("method {  { public },method: void, { T extends Number },, }"));
        Node typeArguments = (Node) getLastChild().getPreviousSibling().getPreviousSibling();
        assertThat(typeArguments.getLabel(), is(JavaEntityType.TYPE_PARAMETERS));
        assertThat(getSource(typeArguments), is("T extends Number"));
        Node typeArgument = (Node) typeArguments.getFirstLeaf();
        assertThat(getSource(typeArgument), is("T extends Number"));
        assertThat(typeArgument.getLabel(), is(JavaEntityType.TYPE_PARAMETER));
    }
View Full Code Here

    public void methodDeclarationWithMultipleBoundedTypeArgumentShouldBeConverted() throws Exception {
        fSnippet = "public <T extends Number & Serializable> void method() {}";
        prepareCompilation();
        convertMethod("method");
        assertThat(getTreeString(), is("method {  { public },method: void, { T extends Number & Serializable },, }"));
        Node typeArguments = (Node) getLastChild().getPreviousSibling().getPreviousSibling();
        assertThat(getSource(typeArguments), is("T extends Number & Serializable"));
        Node typeArgument = (Node) typeArguments.getFirstLeaf();
        assertThat(getSource(typeArgument), is("T extends Number & Serializable"));
    }
View Full Code Here

    public void methodDeclarationWithOneThrowShouldBeConverted() throws Exception {
        fSnippet = "void method() throws IOException {}";
        prepareCompilation();
        convertMethod("method");
        assertThat(getTreeString(), is("method { ,method: void,,, { IOException } }"));
        Node exceptions = getLastChild();
        assertThat(getSource(exceptions), is("IOException"));
        assertThat(exceptions.getLabel(), is(JavaEntityType.THROW));
        Node exception = (Node) exceptions.getFirstLeaf();
        assertThat(getSource(exception), is("IOException"));
        assertThat(exception.getLabel(), is(JavaEntityType.SINGLE_TYPE));
    }
View Full Code Here

    public void methodDeclarationWithMultipleThrowsShouldBeConverted() throws Exception {
        fSnippet = "void method() throws IOException, OutOfBoundException {}";
        prepareCompilation();
        convertMethod("method");
        assertThat(getTreeString(), is("method { ,method: void,,, { IOException,OutOfBoundException } }"));
        Node exceptions = getLastChild();
        assertThat(getSource(exceptions), is("IOException, OutOfBoundException"));
        Node firstException = (Node) exceptions.getFirstLeaf();
        assertThat(exceptions.getLabel(), is(JavaEntityType.THROW));
        assertThat(getSource(firstException), is("IOException"));
        assertThat(firstException.getLabel(), is(JavaEntityType.SINGLE_TYPE));
        Node secondException = (Node) firstException.getNextSibling();
        assertThat(getSource(secondException), is("OutOfBoundException"));
        assertThat(secondException.getLabel(), is(JavaEntityType.SINGLE_TYPE));
    }
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.