Package de.danielbechler.diff.mock

Examples of de.danielbechler.diff.mock.ObjectWithIdentityAndValue


  }

  @Test(groups = TestGroups.INTEGRATION)
  public void testCompareCollectionWithChangedItem() throws Exception
  {
    final List<?> working = asList(new ObjectWithIdentityAndValue("foo", "1"));
    final List<?> base = asList(new ObjectWithIdentityAndValue("foo", "2"));

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

    assertThat(node).self().hasChanges();
    assertThat(node).child(new CollectionItemElementSelector(new ObjectWithIdentityAndValue("foo")))
        .hasState(DiffNode.State.CHANGED);
  }
View Full Code Here


        .inclusion()
        .exclude().node(NodePath.with("value")).and()
        .filtering().returnNodesWithState(DiffNode.State.IGNORED).and()
        .build();

    final ObjectWithIdentityAndValue working = new ObjectWithIdentityAndValue("1", "foo");
    final ObjectWithIdentityAndValue base = new ObjectWithIdentityAndValue("1", "bar");
    final DiffNode node = objectDiffer.compare(working, base);

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

//    when(configuration.isIntrospectible(any(Node.class))).thenReturn(true);
//    when(configuration.isReturnable(any(Node.class))).thenReturn(true);
//    when(node.hasChanges()).thenReturn(true);

    final DiffNode node = ObjectDifferBuilder.buildDefault().compare(
        new ObjectWithIdentityAndValue("a", "1"),
        new ObjectWithIdentityAndValue("a", "2"));

    assertThat(node).self().hasState(DiffNode.State.CHANGED);
  }
View Full Code Here

  private Collection<ObjectWithIdentityAndValue> collection;

  @BeforeMethod
  public void setUp() throws Exception
  {
    referenceItem = new ObjectWithIdentityAndValue("1", "foo");
    accessor = new CollectionItemAccessor(referenceItem);
    collection = new ArrayList<ObjectWithIdentityAndValue>();
  }
View Full Code Here

  }

  @Test
  public void retrieve_item_from_collection() throws Exception
  {
    collection.add(new ObjectWithIdentityAndValue("1"));

    final Object item = accessor.get(collection);

    assertThat(item).isEqualTo(referenceItem);
  }
View Full Code Here

  }

  @Test
  public void replace_same_item_in_list() throws Exception
  {
    collection.add(new ObjectWithIdentityAndValue("1", "foo"));

    accessor.set(collection, new ObjectWithIdentityAndValue("1", "bar"));

    assertThat(collection).hasSize(1);
    assertThat(collection.iterator().next().getValue()).isEqualTo("bar");
  }
View Full Code Here

  @Test
  public void replace_same_item_in_set() throws Exception
  {
    collection = new HashSet<ObjectWithIdentityAndValue>();
    collection.add(new ObjectWithIdentityAndValue("1", "foo"));

    accessor.set(collection, new ObjectWithIdentityAndValue("1", "bar"));

    assertThat(collection).hasSize(1);
    assertThat(collection.iterator().next().getValue()).isEqualTo("bar");
  }
View Full Code Here

TOP

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

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.