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

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


    private final static String TEST_DATA = "src_change/";

    @Test
    public void unchangedMethodDeclarationShouldNotHaveAnyChanges() throws Exception {
        JavaCompilation compilation = CompilationUtils.compileFile(TEST_DATA + "TestLeft.java");
        Node rootLeft = convertMethodDeclaration("foo", compilation);
        Node rootRight = convertMethodDeclaration("foo", compilation);
        StructureEntityVersion structureEntity = new StructureEntityVersion(JavaEntityType.METHOD, "foo", 0);
        Distiller distiller = getDistiller(structureEntity);
        distiller.extractClassifiedSourceCodeChanges(rootLeft, rootRight);
        assertThat(structureEntity.getSourceCodeChanges().isEmpty(), is(true));
    }
View Full Code Here


    @Test
    public void changedMethodShouldHaveChanges() throws Exception {
        JavaCompilation compilationLeft = CompilationUtils.compileFile(TEST_DATA + "TestLeft.java");
        JavaCompilation compilationRight = CompilationUtils.compileFile(TEST_DATA + "TestRight.java");
        Node rootLeft = convertMethodDeclaration("foo", compilationLeft);
        Node rootRight = convertMethodDeclaration("foo", compilationRight);
        StructureEntityVersion structureEntity = new StructureEntityVersion(JavaEntityType.METHOD, "foo", 0);
        Distiller distiller = getDistiller(structureEntity);
        distiller.extractClassifiedSourceCodeChanges(rootLeft, rootRight);
        assertThat(structureEntity.getSourceCodeChanges().size(), is(2));
    }
View Full Code Here

    @Test
    public void changedFieldShouldHaveChanges() throws Exception {
      JavaCompilation compilationLeft = CompilationUtils.compileFile(TEST_DATA + "TestLeft.java");
      JavaCompilation compilationRight = CompilationUtils.compileFile(TEST_DATA + "TestRight.java");
      Node rootLeft = convertFieldDeclaration("arrayField", compilationLeft);
      Node rootRight = convertFieldDeclaration("arrayField", compilationRight);
      StructureEntityVersion structureEntity = new StructureEntityVersion(JavaEntityType.FIELD, "arrayField", 0);
      Distiller distiller = getDistiller(structureEntity);
      distiller.extractClassifiedSourceCodeChanges(rootLeft, rootRight);
     
      List<SourceCodeChange> changes = structureEntity.getSourceCodeChanges();
View Full Code Here

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

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

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

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

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

    public void fieldDeclarationWithJavadocShouldBeConverted() throws Exception {
        fSnippet = "/**\n * A field\n */\nString aString;";
        prepareCompilation();
        convertField("aString");
        assertThat(getTreeString(), is("aString { /**\n * A field\n */,,String }"));
        Node javadoc = getFirstChild();
        assertThat(getSource(javadoc), is("/**\n * A field\n */"));
        assertThat(javadoc.getLabel(), is(JavaEntityType.JAVADOC));
    }
View Full Code Here

    public void methodDeclarationWithReturnTypeShouldBeConverted() throws Exception {
        fSnippet = "public int method() {}";
        prepareCompilation();
        convertMethod("method");
        assertThat(getTreeString(), is("method {  { public },method: int,,, }"));
        Node returnType = getReturnType();
        assertThat(getSource(returnType), is("int"));
        assertThat(returnType.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.