Package de.danielbechler.diff.mock

Examples of de.danielbechler.diff.mock.ObjectWithString


{
  @Test
  public void test_returns_full_property_graph_of_added_collection_items()
  {
    final Map<String, ObjectWithString> base = Collections.emptyMap();
    final Map<String, ObjectWithString> working = Collections.singletonMap("foo", new ObjectWithString("bar"));

    final ObjectDifferBuilder objectDifferBuilder = ObjectDifferBuilder.startBuilding();
    final ObjectDiffer differ = objectDifferBuilder.build();

    final DiffNode node = differ.compare(working, base);
View Full Code Here


public class AdditionIntegrationIT
{
  @Test
  public void detects_change_from_null_to_object_referenct_as_addition() throws Exception
  {
    final ObjectWithString base = new ObjectWithString();
    final ObjectWithString working = new ObjectWithString("foo");

    final DiffNode node = ObjectDifferBuilder.buildDefault().compare(working, base);

    assertThat(node).child("value").hasState(DiffNode.State.ADDED);
  }
View Full Code Here

  @Test
  public void knowsEqualObject_whenReferenceMatchingModeIsSetToEqualsMethod()
  {
    circularReferenceDetector = new CircularReferenceDetector(CircularReferenceDetector.ReferenceMatchingMode.EQUALS_METHOD);
    circularReferenceDetector.push(new ObjectWithString("foo"), NodePath.withRoot());
    assertThat(circularReferenceDetector.knows(new ObjectWithString("foo"))).isTrue();
  }
View Full Code Here

  @Test
  public void removesEqualObject_whenReferenceMatchingModeIsSetToEqualsMethod()
  {
    circularReferenceDetector = new CircularReferenceDetector(CircularReferenceDetector.ReferenceMatchingMode.EQUALS_METHOD);
    circularReferenceDetector.push(new ObjectWithString("foo"), NodePath.withRoot());
    circularReferenceDetector.remove(new ObjectWithString("foo"));
    assertThat(circularReferenceDetector.size()).isEqualTo(0);
  }
View Full Code Here

  @Test(expectedExceptions = CircularReferenceDetector.CircularReferenceException.class)
  public void throwsException_onAttemptToPushEqualObject_whenReferenceMatchingModeIsSetToEqualsMethod()
  {
    circularReferenceDetector = new CircularReferenceDetector(CircularReferenceDetector.ReferenceMatchingMode.EQUALS_METHOD);
    circularReferenceDetector.push(new ObjectWithString("foo"), NodePath.withRoot());
    circularReferenceDetector.push(new ObjectWithString("foo"), NodePath.withRoot());
  }
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

TOP

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

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.