@Test
  public void testFetchByPrimaryKeyExisting() throws Exception {
    AnnouncementsDelivery newAnnouncementsDelivery = addAnnouncementsDelivery();

    AnnouncementsDelivery existingAnnouncementsDelivery =
        _persistence.fetchByPrimaryKey(newAnnouncementsDelivery.getPrimaryKey());

    Assert.assertEquals(existingAnnouncementsDelivery, newAnnouncementsDelivery);
  }
  @Test
  public void testCreate() throws Exception {
    long pk = ServiceTestUtil.nextLong();

    AnnouncementsDelivery announcementsDelivery = _persistence.create(pk);

    Assert.assertNotNull(announcementsDelivery);

    Assert.assertEquals(announcementsDelivery.getPrimaryKey(), pk);
  }
  @Test
  public void testRemove() throws Exception {
    AnnouncementsDelivery newAnnouncementsDelivery = addAnnouncementsDelivery();

    _persistence.remove(newAnnouncementsDelivery);

    AnnouncementsDelivery existingAnnouncementsDelivery =
        _persistence.fetchByPrimaryKey(newAnnouncementsDelivery.getPrimaryKey());

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

    AnnouncementsDelivery newAnnouncementsDelivery = addAnnouncementsDelivery();

    _persistence.clearCache();

    AnnouncementsDeliveryModelImpl existingAnnouncementsDeliveryModelImpl =
        (AnnouncementsDeliveryModelImpl)
            _persistence.findByPrimaryKey(newAnnouncementsDelivery.getPrimaryKey());

    Assert.assertEquals(
        existingAnnouncementsDeliveryModelImpl.getUserId(),
        existingAnnouncementsDeliveryModelImpl.getOriginalUserId());
    Assert.assertTrue(
        Validator.equals(
            existingAnnouncementsDeliveryModelImpl.getType(),
            existingAnnouncementsDeliveryModelImpl.getOriginalType()));
  }
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = ServiceTestUtil.nextLong();

    AnnouncementsDelivery newAnnouncementsDelivery = _persistence.create(pk);

    newAnnouncementsDelivery.setCompanyId(ServiceTestUtil.nextLong());

    newAnnouncementsDelivery.setUserId(ServiceTestUtil.nextLong());

    newAnnouncementsDelivery.setType(ServiceTestUtil.randomString());

    newAnnouncementsDelivery.setEmail(ServiceTestUtil.randomBoolean());

    newAnnouncementsDelivery.setSms(ServiceTestUtil.randomBoolean());

    newAnnouncementsDelivery.setWebsite(ServiceTestUtil.randomBoolean());

    _persistence.update(newAnnouncementsDelivery, false);

    AnnouncementsDelivery existingAnnouncementsDelivery =
        _persistence.findByPrimaryKey(newAnnouncementsDelivery.getPrimaryKey());

    Assert.assertEquals(
        existingAnnouncementsDelivery.getDeliveryId(), newAnnouncementsDelivery.getDeliveryId());
    Assert.assertEquals(
        existingAnnouncementsDelivery.getCompanyId(), newAnnouncementsDelivery.getCompanyId());
    Assert.assertEquals(
        existingAnnouncementsDelivery.getUserId(), newAnnouncementsDelivery.getUserId());
    Assert.assertEquals(
        existingAnnouncementsDelivery.getType(), newAnnouncementsDelivery.getType());
    Assert.assertEquals(
        existingAnnouncementsDelivery.getEmail(), newAnnouncementsDelivery.getEmail());
    Assert.assertEquals(existingAnnouncementsDelivery.getSms(), newAnnouncementsDelivery.getSms());
    Assert.assertEquals(
        existingAnnouncementsDelivery.getWebsite(), newAnnouncementsDelivery.getWebsite());
  }