@Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    RosterMember newRosterMember = _persistence.create(pk);

    newRosterMember.setUuid(RandomTestUtil.randomString());

    newRosterMember.setCreateDate(RandomTestUtil.nextDate());

    newRosterMember.setModifiedDate(RandomTestUtil.nextDate());

    newRosterMember.setRosterId(RandomTestUtil.nextLong());

    newRosterMember.setContactId(RandomTestUtil.nextLong());

    _rosterMembers.add(_persistence.update(newRosterMember));

    RosterMember existingRosterMember =
        _persistence.findByPrimaryKey(newRosterMember.getPrimaryKey());

    Assert.assertEquals(existingRosterMember.getUuid(), newRosterMember.getUuid());
    Assert.assertEquals(
        existingRosterMember.getRosterMemberId(), newRosterMember.getRosterMemberId());
    Assert.assertEquals(
        Time.getShortTimestamp(existingRosterMember.getCreateDate()),
        Time.getShortTimestamp(newRosterMember.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingRosterMember.getModifiedDate()),
        Time.getShortTimestamp(newRosterMember.getModifiedDate()));
    Assert.assertEquals(existingRosterMember.getRosterId(), newRosterMember.getRosterId());
    Assert.assertEquals(existingRosterMember.getContactId(), newRosterMember.getContactId());
  }
  @Test
  public void testDynamicQueryByPrimaryKeyExisting() throws Exception {
    RosterMember newRosterMember = addRosterMember();

    DynamicQuery dynamicQuery =
        DynamicQueryFactoryUtil.forClass(RosterMember.class, _dynamicQueryClassLoader);

    dynamicQuery.add(
        RestrictionsFactoryUtil.eq("rosterMemberId", newRosterMember.getRosterMemberId()));

    List<RosterMember> result = _persistence.findWithDynamicQuery(dynamicQuery);

    Assert.assertEquals(1, result.size());

    RosterMember existingRosterMember = result.get(0);

    Assert.assertEquals(existingRosterMember, newRosterMember);
  }
  @Test
  public void testDynamicQueryByProjectionExisting() throws Exception {
    RosterMember newRosterMember = addRosterMember();

    DynamicQuery dynamicQuery =
        DynamicQueryFactoryUtil.forClass(RosterMember.class, _dynamicQueryClassLoader);

    dynamicQuery.setProjection(ProjectionFactoryUtil.property("rosterMemberId"));

    Object newRosterMemberId = newRosterMember.getRosterMemberId();

    dynamicQuery.add(
        RestrictionsFactoryUtil.in("rosterMemberId", new Object[] {newRosterMemberId}));

    List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);

    Assert.assertEquals(1, result.size());

    Object existingRosterMemberId = result.get(0);

    Assert.assertEquals(existingRosterMemberId, newRosterMemberId);
  }