Package de.danielbechler.diff.node

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


    final TopHat hat2 = new TopHat(2, 20);

    final Person p1 = new Person(hat1);
    final Person p2 = new Person(hat2);

    final DiffNode root = objectDiffer.compare(p1, p2);

    root.visit(new DiffNode.Visitor()
    {
      public void node(final DiffNode node, final Visit visit)
      {
        System.out.print(node.getPath() + " :: ");
        System.out.print(node.canonicalGet(p1));
View Full Code Here


public class NodeAssertionsTest
{
  @Test
  public void testAssertThat_node_does_exist_succeeds_when_node_exists() throws Exception
  {
    final DiffNode node = new DiffNode(String.class);
    assertThat(node).root().doesExist();
  }
View Full Code Here

  }

  @Test(expectedExceptions = AssertionError.class)
  public void testAssertThat_node_does_not_exist_fails_when_node_exist() throws Exception
  {
    final DiffNode node = new DiffNode(String.class);
    assertThat(node).root().doesNotExist();
  }
View Full Code Here

  }

  @Test
  public void testAssertThat_node_has_children_succeeds_when_children_are_present() throws Exception
  {
    final DiffNode root = new DiffNode(String.class);
    final DiffNode child = new DiffNode(root, mock(Accessor.class), String.class);
    root.addChild(child);
    assertThat(root).root().hasChildren();
  }
View Full Code Here

  }

  @Test(expectedExceptions = AssertionError.class)
  public void testAssertThat_node_has_children_fails_when_no_children_are_present() throws Exception
  {
    final DiffNode node = new DiffNode(String.class);
    assertThat(node).root().hasChildren();
  }
View Full Code Here

  @Test
  public void testAssertThat_child_at_property_names_does_exist_succeeds_when_child_exists()
  {
    final Accessor accessor = mock(Accessor.class);
    when(accessor.getElementSelector()).thenReturn(new BeanPropertyElementSelector("value"));
    final DiffNode node = new DiffNode(ObjectWithString.class);
    final DiffNode child = new DiffNode(node, accessor, String.class);
    node.addChild(child);
    assertThat(node).child("value").doesExist();
  }
View Full Code Here

  @Test
  public void testAssertThat_child_at_property_path_does_exist_succeeds_when_child_exists()
  {
    final ObjectWithString working = new ObjectWithString("foo");
    final ObjectWithString base = new ObjectWithString("bar");
    final DiffNode node = ObjectDifferBuilder.buildDefault().compare(working, base);
    assertThat(node).child(NodePath.with("value")).doesExist();
  }
View Full Code Here

  @Test
  public void testAssertThat_child_at_property_path_builder_does_exist_succeeds_when_child_exist()
  {
    final ObjectWithString working = new ObjectWithString("foo");
    final ObjectWithString base = new ObjectWithString("bar");
    final DiffNode node = ObjectDifferBuilder.buildDefault().compare(working, base);
    assertThat(node).child(NodePath.startBuilding().propertyName("value")).doesExist();
  }
View Full Code Here

  }

  @Test
  public void testAssertThat_node_has_no_children_succeeds_when_node_has_no_children()
  {
    final DiffNode node = new DiffNode(String.class);
    assertThat(node).root().hasNoChildren();
  }
View Full Code Here

  }

  @Test(expectedExceptions = AssertionError.class)
  public void testAssertThat_node_has_no_children_fails_when_node_has_children()
  {
    final DiffNode root = new DiffNode(String.class);
    final DiffNode child = new DiffNode(root, mock(Accessor.class), String.class);
    root.addChild(child);
    assertThat(root).root().hasNoChildren();
  }
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.