Package de.danielbechler.diff.mock

Examples of de.danielbechler.diff.mock.ObjectWithCircularReference


public class IgnoreIT
{
  @Test
  public void verify_that_ignore_rules_with_complex_paths_works_properly() throws Exception
  {
    final ObjectWithCircularReference obj1 = new ObjectWithCircularReference("1");
    final ObjectWithCircularReference obj2 = new ObjectWithCircularReference("2");
    final ObjectWithCircularReference obj3 = new ObjectWithCircularReference("3");
    obj1.setReference(obj2);
    obj2.setReference(obj3);

    final ObjectWithCircularReference modifiedObj1 = new ObjectWithCircularReference("1");
    final ObjectWithCircularReference modifiedObj2 = new ObjectWithCircularReference("2");
    final ObjectWithCircularReference modifiedObj3 = new ObjectWithCircularReference("4");
    modifiedObj1.setReference(modifiedObj2);
    modifiedObj2.setReference(modifiedObj3);

    final NodePath nodePath = NodePath.with("reference", "reference");
View Full Code Here


public class CircularReferenceIT
{
  @Test
  public void testCircularReference()
  {
    final ObjectWithCircularReference workingA = new ObjectWithCircularReference("a");
    final ObjectWithCircularReference workingB = new ObjectWithCircularReference("b");
    workingA.setReference(workingB);
    workingB.setReference(workingA);

    final ObjectWithCircularReference baseA = new ObjectWithCircularReference("a");
    final ObjectWithCircularReference baseB = new ObjectWithCircularReference("c");
    baseA.setReference(baseB);
    baseB.setReference(baseA);

    final DiffNode root = ObjectDifferBuilder.buildDefault().compare(workingA, baseA);
    assertThat(root).child("reference", "reference").isCircular();
    assertThat(root).child("reference", "reference")
        .hasCircularStartPathEqualTo(NodePath.withRoot());
View Full Code Here

  }

  @Test
  public void testCircularReferenceShouldBeAddedWhenEnabledInConfiguration()
  {
    final ObjectWithCircularReference workingA = new ObjectWithCircularReference("a");
    final ObjectWithCircularReference workingB = new ObjectWithCircularReference("b");
    final ObjectWithCircularReference workingC = new ObjectWithCircularReference("c");
    workingA.setReference(workingB);
    workingB.setReference(workingC);
    workingC.setReference(workingA);

    final ObjectWithCircularReference baseA = new ObjectWithCircularReference("a");
    final ObjectWithCircularReference baseB = new ObjectWithCircularReference("b");
    final ObjectWithCircularReference baseC = new ObjectWithCircularReference("d");
    baseA.setReference(baseB);
    baseB.setReference(baseC);
    baseC.setReference(baseA);

    final ObjectDiffer objectDiffer = ObjectDifferBuilder.buildDefault();
//    objectDiffer.getConfiguration().withoutCircularNodes();
    final DiffNode root = objectDiffer.compare(workingA, baseA);
    root.visit(new PrintingVisitor(workingA, baseA));
View Full Code Here

  }

  @Test
  public void omits_intermediate_nodes_with_changed_child_nodes()
  {
    final ObjectWithCircularReference a1 = new ObjectWithCircularReference("a");
    final ObjectWithCircularReference b1 = new ObjectWithCircularReference("b");
    final ObjectWithCircularReference c1 = new ObjectWithCircularReference("c");
    a1.setReference(b1);
    b1.setReference(c1);

    final ObjectWithCircularReference a2 = new ObjectWithCircularReference("a");
    final ObjectWithCircularReference b2 = new ObjectWithCircularReference("b");
    final ObjectWithCircularReference d2 = new ObjectWithCircularReference("d");
    a2.setReference(b2);
    b2.setReference(d2);

    final DiffNode rootNode = ObjectDifferBuilder.buildDefault().compare(a1, a2);
    final TestablePrintingVisitor visitor = new TestablePrintingVisitor(a1, a2);
View Full Code Here

TOP

Related Classes of de.danielbechler.diff.mock.ObjectWithCircularReference

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.