public void testUpdateExisting() throws Exception {
    long pk = nextLong();

    UserTracker newUserTracker = _persistence.create(pk);

    newUserTracker.setCompanyId(nextLong());
    newUserTracker.setUserId(nextLong());
    newUserTracker.setModifiedDate(nextDate());
    newUserTracker.setSessionId(randomString());
    newUserTracker.setRemoteAddr(randomString());
    newUserTracker.setRemoteHost(randomString());
    newUserTracker.setUserAgent(randomString());

    _persistence.update(newUserTracker, false);

    UserTracker existingUserTracker = _persistence.findByPrimaryKey(newUserTracker.getPrimaryKey());

    assertEquals(existingUserTracker.getUserTrackerId(), newUserTracker.getUserTrackerId());
    assertEquals(existingUserTracker.getCompanyId(), newUserTracker.getCompanyId());
    assertEquals(existingUserTracker.getUserId(), newUserTracker.getUserId());
    assertEquals(
        Time.getShortTimestamp(existingUserTracker.getModifiedDate()),
        Time.getShortTimestamp(newUserTracker.getModifiedDate()));
    assertEquals(existingUserTracker.getSessionId(), newUserTracker.getSessionId());
    assertEquals(existingUserTracker.getRemoteAddr(), newUserTracker.getRemoteAddr());
    assertEquals(existingUserTracker.getRemoteHost(), newUserTracker.getRemoteHost());
    assertEquals(existingUserTracker.getUserAgent(), newUserTracker.getUserAgent());
  }
  protected UserTracker addUserTracker() throws Exception {
    long pk = nextLong();

    UserTracker userTracker = _persistence.create(pk);

    userTracker.setCompanyId(nextLong());
    userTracker.setUserId(nextLong());
    userTracker.setModifiedDate(nextDate());
    userTracker.setSessionId(randomString());
    userTracker.setRemoteAddr(randomString());
    userTracker.setRemoteHost(randomString());
    userTracker.setUserAgent(randomString());

    _persistence.update(userTracker, false);

    return userTracker;
  }