protected Website addWebsite() throws Exception {
    long pk = RandomTestUtil.nextLong();

    Website website = _persistence.create(pk);

    website.setMvccVersion(RandomTestUtil.nextLong());

    website.setUuid(RandomTestUtil.randomString());

    website.setCompanyId(RandomTestUtil.nextLong());

    website.setUserId(RandomTestUtil.nextLong());

    website.setUserName(RandomTestUtil.randomString());

    website.setCreateDate(RandomTestUtil.nextDate());

    website.setModifiedDate(RandomTestUtil.nextDate());

    website.setClassNameId(RandomTestUtil.nextLong());

    website.setClassPK(RandomTestUtil.nextLong());

    website.setUrl(RandomTestUtil.randomString());

    website.setTypeId(RandomTestUtil.nextLong());

    website.setPrimary(RandomTestUtil.randomBoolean());

    website.setLastPublishDate(RandomTestUtil.nextDate());

    _websites.add(_persistence.update(website));

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

    Website newWebsite = _persistence.create(pk);

    newWebsite.setMvccVersion(RandomTestUtil.nextLong());

    newWebsite.setUuid(RandomTestUtil.randomString());

    newWebsite.setCompanyId(RandomTestUtil.nextLong());

    newWebsite.setUserId(RandomTestUtil.nextLong());

    newWebsite.setUserName(RandomTestUtil.randomString());

    newWebsite.setCreateDate(RandomTestUtil.nextDate());

    newWebsite.setModifiedDate(RandomTestUtil.nextDate());

    newWebsite.setClassNameId(RandomTestUtil.nextLong());

    newWebsite.setClassPK(RandomTestUtil.nextLong());

    newWebsite.setUrl(RandomTestUtil.randomString());

    newWebsite.setTypeId(RandomTestUtil.nextLong());

    newWebsite.setPrimary(RandomTestUtil.randomBoolean());

    newWebsite.setLastPublishDate(RandomTestUtil.nextDate());

    _websites.add(_persistence.update(newWebsite));

    Website existingWebsite = _persistence.findByPrimaryKey(newWebsite.getPrimaryKey());

    Assert.assertEquals(existingWebsite.getMvccVersion(), newWebsite.getMvccVersion());
    Assert.assertEquals(existingWebsite.getUuid(), newWebsite.getUuid());
    Assert.assertEquals(existingWebsite.getWebsiteId(), newWebsite.getWebsiteId());
    Assert.assertEquals(existingWebsite.getCompanyId(), newWebsite.getCompanyId());
    Assert.assertEquals(existingWebsite.getUserId(), newWebsite.getUserId());
    Assert.assertEquals(existingWebsite.getUserName(), newWebsite.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingWebsite.getCreateDate()),
        Time.getShortTimestamp(newWebsite.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingWebsite.getModifiedDate()),
        Time.getShortTimestamp(newWebsite.getModifiedDate()));
    Assert.assertEquals(existingWebsite.getClassNameId(), newWebsite.getClassNameId());
    Assert.assertEquals(existingWebsite.getClassPK(), newWebsite.getClassPK());
    Assert.assertEquals(existingWebsite.getUrl(), newWebsite.getUrl());
    Assert.assertEquals(existingWebsite.getTypeId(), newWebsite.getTypeId());
    Assert.assertEquals(existingWebsite.getPrimary(), newWebsite.getPrimary());
    Assert.assertEquals(
        Time.getShortTimestamp(existingWebsite.getLastPublishDate()),
        Time.getShortTimestamp(newWebsite.getLastPublishDate()));
  }