コード例 #1
0
  @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());
  }
コード例 #2
0
  protected RosterMember addRosterMember() throws Exception {
    long pk = RandomTestUtil.nextLong();

    RosterMember rosterMember = _persistence.create(pk);

    rosterMember.setUuid(RandomTestUtil.randomString());

    rosterMember.setCreateDate(RandomTestUtil.nextDate());

    rosterMember.setModifiedDate(RandomTestUtil.nextDate());

    rosterMember.setRosterId(RandomTestUtil.nextLong());

    rosterMember.setContactId(RandomTestUtil.nextLong());

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

    return rosterMember;
  }