Package de.danielbechler.diff.selector

Examples of de.danielbechler.diff.selector.BeanPropertyElementSelector


  public void testWithPropertyName()
  {
    final NodePath nodePath = NodePath.startBuilding().propertyName("foo", "bar").build();
    assertThat(nodePath.getElementSelectors()).containsSequence(
        RootElementSelector.getInstance(),
        new BeanPropertyElementSelector("foo"),
        new BeanPropertyElementSelector("bar")
    );
  }
View Full Code Here


  @Test
  public void testWithPropertyPath()
  {
    final NodePath nodePath = NodePath.startBuildingFrom(NodePath.with("foo")).build();
    assertThat(nodePath.getElementSelectors()).containsSequence(RootElementSelector.getInstance(), new BeanPropertyElementSelector("foo"));
  }
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

    doReturn(true).when(introspectableResolver).isIntrospectable(node(withRoot()));
  }

  private PropertyAwareAccessor given_introspector_returns_PropertyAccessor(final String propertyName)
  {
    final BeanPropertyElementSelector propertyElement = new BeanPropertyElementSelector(propertyName);
    final PropertyAwareAccessor propertyAccessor = mock(PropertyAwareAccessor.class);
    when(propertyAccessor.getElementSelector()).thenReturn(propertyElement);
    final TypeInfo typeInfo = new TypeInfo(Class.class);
    typeInfo.addPropertyAccessor(propertyAccessor);
    when(typeInfoResolver.typeInfoForNode(any(DiffNode.class))).thenReturn(typeInfo);
View Full Code Here

                    final Object base,
                    final Object working,
                    final Object fresh)
  {
    when(accessor.getType()).then(returnClass(type));
    when(accessor.getElementSelector()).thenReturn(new BeanPropertyElementSelector("ignored"));
    instances = mock(Instances.class);
    when(instances.getWorking()).thenReturn(working);
    when(instances.getBase()).thenReturn(base);
    when(instances.getFresh()).thenReturn(fresh);
    when(instances.getSourceAccessor()).thenReturn(accessor);
View Full Code Here

  @Test
  public void getPropertyPath_with_parent_node_should_return_canonical_path()
  {
    final DiffNode parentNode = new DiffNode(RootAccessor.getInstance(), String.class);
    Mockito.when(accessor.getElementSelector()).thenReturn(new BeanPropertyElementSelector("foo"));

    final DiffNode root = new DiffNode(parentNode, accessor, Object.class);

    assertThat(root.getPath()).isEqualTo(NodePath.with("foo"));
  }
View Full Code Here

      return this;
    }

    public AppendableBuilder propertyName(final String name, final String... names)
    {
      elementSelectors.add(new BeanPropertyElementSelector(name));
      for (final String s : names)
      {
        elementSelectors.add(new BeanPropertyElementSelector(s));
      }
      return this;
    }
View Full Code Here

   * @param propertyName The name of the property represented by the child node.
   * @return The requested child node or <code>null</code>.
   */
  public DiffNode getChild(final String propertyName)
  {
    return getChild(new BeanPropertyElementSelector(propertyName));
  }
View Full Code Here

    return null;
  }

  public BeanPropertyElementSelector getElementSelector()
  {
    return new BeanPropertyElementSelector(this.propertyName);
  }
View Full Code Here

TOP

Related Classes of de.danielbechler.diff.selector.BeanPropertyElementSelector

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.