Package de.danielbechler.diff.path

Examples of de.danielbechler.diff.path.NodePath$AppendableBuilderImpl


    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");

    // verify that the node can be found when it's not excluded
    ObjectDiffer objectDiffer = ObjectDifferBuilder.startBuilding().build();
    final DiffNode verification = objectDiffer.compare(obj1, modifiedObj1);
    verification.visit(new PrintingVisitor(obj1, modifiedObj1));
View Full Code Here


          .build());
      Assertions.fail("Expected CircularReferenceException wasn't thrown.");
    }
    catch (CircularReferenceDetector.CircularReferenceException e)
    {
      final NodePath nodePath = e.getNodePath();
      assertThat(nodePath).isEqualTo(NodePath.withRoot());
    }
  }
View Full Code Here

  public void testGetMessage_returns_message_when_message_present() throws Exception
  {
    final DiffNode node = new DiffNode(String.class);
    node.setState(DiffNode.State.CHANGED);
    node.visit(visitor);
    final NodePath path = NodePath.withRoot();
    assertThat(visitor.getMessage(path)).isNotEmpty();
  }
View Full Code Here

  public void testGetMessage_returns_null_when_message_absend() throws Exception
  {
    final DiffNode node = new DiffNode(String.class);
    node.setState(DiffNode.State.CHANGED);
    node.visit(visitor);
    final NodePath path = NodePath.with("doesn't-exist");
    assertThat(visitor.getMessage(path)).isNull();
  }
View Full Code Here

    this.nodePath = nodePath;
  }

  public void node(final DiffNode node, final Visit visit)
  {
    final NodePath differencePath = node.getPath();
    if (differencePath.matches(nodePath) || differencePath.isParentOf(nodePath))
    {
      if (differencePath.matches(nodePath))
      {
        this.node = node;
        visit.stop();
      }
    }
View Full Code Here

  }

  @Test
  public void assign_the_circular_start_path_if_the_delegated_node_is_circular() throws Exception
  {
    final NodePath circularStartPath = NodePath.withRoot();
    given_the_delegated_node_is_circular(circularStartPath);

    final DiffNode node = differDispatcher.dispatch(DiffNode.ROOT, instances, accessor);

    assertThat(node.getCircleStartPath()).isEqualTo(circularStartPath);
View Full Code Here

    public boolean matches(final Object argument)
    {
      if (argument instanceof DiffNode)
      {
        final DiffNode node = (DiffNode) argument;
        final NodePath path = node.getPath();
        if (expectedNodePath != null && path != null && !path.matches(this.expectedNodePath))
        {
          return false;
        }
        if (expectedTypeHint != null && expectedTypeHint != node.getValueType())
        {
View Full Code Here

  {
    final List<String> propertyNames = asList("things", "include");
    ObjectDifferBuilder builder = ObjectDifferBuilder.startBuilding();
    for (final String name : propertyNames)
    {
      final NodePath nodePath = NodePath.with(name);
      builder.comparison().ofNode(nodePath).toUseEqualsMethod();
      builder.inclusion().include().node(nodePath);
    }

    final Thing thingOne = new Thing("a", "b");
View Full Code Here

    return differ.compare(parentNode, instances);
  }

  protected void forgetInstances(final DiffNode parentNode, final Instances instances)
  {
    final NodePath nodePath;
    if (parentNode != null)
    {
      final NodePath parentPath = parentNode.getPath();
      final ElementSelector elementSelector = instances.getSourceAccessor().getElementSelector();
      nodePath = NodePath.startBuildingFrom(parentPath).element(elementSelector).build();
    }
    else
    {
View Full Code Here

    baseCircularReferenceDetector.remove(instances.getBase());
  }

  protected void rememberInstances(final DiffNode parentNode, final Instances instances)
  {
    final NodePath nodePath;
    if (parentNode != null)
    {
      final NodePath parentPath = parentNode.getPath();
      final ElementSelector elementSelector = instances.getSourceAccessor().getElementSelector();
      nodePath = NodePath.startBuildingFrom(parentPath).element(elementSelector).build();
    }
    else
    {
View Full Code Here

TOP

Related Classes of de.danielbechler.diff.path.NodePath$AppendableBuilderImpl

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.