@Test
  public void testResetOriginalValues() throws Exception {
    if (!PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
      return;
    }

    SocialActivitySetting newSocialActivitySetting = addSocialActivitySetting();

    _persistence.clearCache();

    SocialActivitySettingModelImpl existingSocialActivitySettingModelImpl =
        (SocialActivitySettingModelImpl)
            _persistence.findByPrimaryKey(newSocialActivitySetting.getPrimaryKey());

    Assert.assertEquals(
        existingSocialActivitySettingModelImpl.getGroupId(),
        existingSocialActivitySettingModelImpl.getOriginalGroupId());
    Assert.assertEquals(
        existingSocialActivitySettingModelImpl.getClassNameId(),
        existingSocialActivitySettingModelImpl.getOriginalClassNameId());
    Assert.assertEquals(
        existingSocialActivitySettingModelImpl.getActivityType(),
        existingSocialActivitySettingModelImpl.getOriginalActivityType());
    Assert.assertTrue(
        Validator.equals(
            existingSocialActivitySettingModelImpl.getName(),
            existingSocialActivitySettingModelImpl.getOriginalName()));
  }
  @Test
  public void testFetchByPrimaryKeyExisting() throws Exception {
    SocialActivitySetting newSocialActivitySetting = addSocialActivitySetting();

    SocialActivitySetting existingSocialActivitySetting =
        _persistence.fetchByPrimaryKey(newSocialActivitySetting.getPrimaryKey());

    Assert.assertEquals(existingSocialActivitySetting, newSocialActivitySetting);
  }
  @Test
  public void testCreate() throws Exception {
    long pk = RandomTestUtil.nextLong();

    SocialActivitySetting socialActivitySetting = _persistence.create(pk);

    Assert.assertNotNull(socialActivitySetting);

    Assert.assertEquals(socialActivitySetting.getPrimaryKey(), pk);
  }
  @Test
  public void testRemove() throws Exception {
    SocialActivitySetting newSocialActivitySetting = addSocialActivitySetting();

    _persistence.remove(newSocialActivitySetting);

    SocialActivitySetting existingSocialActivitySetting =
        _persistence.fetchByPrimaryKey(newSocialActivitySetting.getPrimaryKey());

    Assert.assertNull(existingSocialActivitySetting);
  }
  @Override
  public int compareTo(SocialActivitySetting socialActivitySetting) {
    long primaryKey = socialActivitySetting.getPrimaryKey();

    if (getPrimaryKey() < primaryKey) {
      return -1;
    } else if (getPrimaryKey() > primaryKey) {
      return 1;
    } else {
      return 0;
    }
  }
  @Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }

    if (!(obj instanceof SocialActivitySetting)) {
      return false;
    }

    SocialActivitySetting socialActivitySetting = (SocialActivitySetting) obj;

    long primaryKey = socialActivitySetting.getPrimaryKey();

    if (getPrimaryKey() == primaryKey) {
      return true;
    } else {
      return false;
    }
  }
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    SocialActivitySetting newSocialActivitySetting = _persistence.create(pk);

    newSocialActivitySetting.setGroupId(RandomTestUtil.nextLong());

    newSocialActivitySetting.setCompanyId(RandomTestUtil.nextLong());

    newSocialActivitySetting.setClassNameId(RandomTestUtil.nextLong());

    newSocialActivitySetting.setActivityType(RandomTestUtil.nextInt());

    newSocialActivitySetting.setName(RandomTestUtil.randomString());

    newSocialActivitySetting.setValue(RandomTestUtil.randomString());

    _persistence.update(newSocialActivitySetting);

    SocialActivitySetting existingSocialActivitySetting =
        _persistence.findByPrimaryKey(newSocialActivitySetting.getPrimaryKey());

    Assert.assertEquals(
        existingSocialActivitySetting.getActivitySettingId(),
        newSocialActivitySetting.getActivitySettingId());
    Assert.assertEquals(
        existingSocialActivitySetting.getGroupId(), newSocialActivitySetting.getGroupId());
    Assert.assertEquals(
        existingSocialActivitySetting.getCompanyId(), newSocialActivitySetting.getCompanyId());
    Assert.assertEquals(
        existingSocialActivitySetting.getClassNameId(), newSocialActivitySetting.getClassNameId());
    Assert.assertEquals(
        existingSocialActivitySetting.getActivityType(),
        newSocialActivitySetting.getActivityType());
    Assert.assertEquals(
        existingSocialActivitySetting.getName(), newSocialActivitySetting.getName());
    Assert.assertEquals(
        existingSocialActivitySetting.getValue(), newSocialActivitySetting.getValue());
  }