Package de.danielbechler.diff.node

Examples of de.danielbechler.diff.node.DiffNode$Visitor


    assertThat(root).child("directReference", "value").hasState(DiffNode.State.CHANGED).hasNoChildren();
  }

  private static DiffNode compareAndPrint(final GraphNode modified, final GraphNode base)
  {
    final DiffNode root = ObjectDifferBuilder.buildDefault().compare(modified, base);
    if (PRINT_ENABLED)
    {
      root.visit(new PrintingVisitor(modified, base));
    }
    return root;
  }
View Full Code Here


    final GraphNode modified = new GraphNode(1);
    final GraphNode modifiedA = new GraphNode(2, "ax");
    modified.setDirectReference(modifiedA);

    final DiffNode root = compareAndPrint(modified, base);

    assertThat(root).root().hasChildren(1);
    assertThat(root).child("directReference", "value").hasState(DiffNode.State.CHANGED).hasNoChildren();
  }
View Full Code Here

    final GraphNode modifiedA = new GraphNode(2, "ax");
    final GraphNode modifiedB = new GraphNode(3, "by");
    modified.addChildren(modifiedA, modifiedB);
    establishCircularDirectReference(modifiedA, modifiedB);

    final DiffNode root = compareAndPrint(modified, base);

    assertThat(root).root().hasChildren(1);
    assertThat(root).child("children").hasChildren(2);
    assertThat(root).child(startBuilding()
        .propertyName("children")
View Full Code Here

    modified.addChild(modifiedB);
    establishCircularDirectReference(modifiedA, modifiedB);
    modifiedA.getMap().put("node-b", modifiedB);
    modifiedB.getMap().put("node-a", modifiedA);

    final DiffNode root = compareAndPrint(modified, base);

    /*
     * one could assume that this node would be marked as removed, but since the instance it represents
     * is a parent of it, we cannot reliably test, whether the node has been changed. (added or removed
     * is easier, but since changed is not yet possible, that would be inconsistent)
View Full Code Here

    final GraphNode modifiedA = new GraphNode(1, "ax");
    final GraphNode modifiedB = new GraphNode(2, "by");
    establishCircularDirectReference(modifiedA, modifiedB);

    final DiffNode root = compareAndPrint(modifiedA, a);

    assertThat(root).child("directReference", "value").hasState(DiffNode.State.CHANGED).hasNoChildren();
    assertThat(root).child("value").hasState(DiffNode.State.CHANGED).hasNoChildren();
  }
View Full Code Here

    final GraphNode modified = new GraphNode("modified");
    final GraphNode modifiedA = new GraphNode("ax");
    modified.setDirectReference(modifiedA);

    final DiffNode root = compareAndPrint(modified, base);

    assertThat(root).child("directReference", "value").hasState(DiffNode.State.CHANGED).hasNoChildren();
    assertThat(root).child("value").hasState(DiffNode.State.CHANGED).hasNoChildren();
  }
View Full Code Here

    final GraphNode modifiedA = new GraphNode("a");
    final GraphNode modifiedB = new GraphNode("bx");
    modified.getChildren().add(modifiedA);
    modified.getChildren().add(modifiedB);

    final DiffNode root = compareAndPrint(modified, base);

    NodeAssertions.assertThat(root).root().hasState(DiffNode.State.UNTOUCHED); // not a bug!

    // NOTE: This is expected, since Collections (and java-object-diff) rely heavily on the proper
    // implementation of hashCode and equals. The GraphNode uses the ID as sole criteria in it's
View Full Code Here

    final GraphNode modifiedB = new GraphNode(3, "by");
    final GraphNode modified = new GraphNode(1);
    modified.addChild(modifiedA);
    modified.addChild(modifiedB);

    final DiffNode root = compareAndPrint(modified, base);

    NodeAssertions.assertThat(root).child(startBuilding()
        .propertyName("children")
        .collectionItem(a))
        .hasState(DiffNode.State.CHANGED)
View Full Code Here

    establishParentChildRelationship(base, a);
    final GraphNode modified = new GraphNode(1);
    final GraphNode modifiedA = new GraphNode(2, "ax");
    establishParentChildRelationship(modified, modifiedA);

    final DiffNode root = compareAndPrint(modified, base);

    NodeAssertions.assertThat(root).child(startBuilding()
        .propertyName("children")
        .collectionItem(modifiedA)
        .propertyName("value"))
View Full Code Here

    establishParentChildRelationship(base, a);
    final GraphNode modified = new GraphNode(1);
    final GraphNode modifiedA = new GraphNode(2, "a");
    establishParentChildRelationship(modified, modifiedA);

    final DiffNode root = compareAndPrint(modified, base);

    assertThat(root).root().hasState(DiffNode.State.UNTOUCHED);
  }
View Full Code Here

TOP

Related Classes of de.danielbechler.diff.node.DiffNode$Visitor

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.