protected AnnouncementsDelivery addAnnouncementsDelivery() throws Exception {
    long pk = ServiceTestUtil.nextLong();

    AnnouncementsDelivery announcementsDelivery = _persistence.create(pk);

    announcementsDelivery.setCompanyId(ServiceTestUtil.nextLong());

    announcementsDelivery.setUserId(ServiceTestUtil.nextLong());

    announcementsDelivery.setType(ServiceTestUtil.randomString());

    announcementsDelivery.setEmail(ServiceTestUtil.randomBoolean());

    announcementsDelivery.setSms(ServiceTestUtil.randomBoolean());

    announcementsDelivery.setWebsite(ServiceTestUtil.randomBoolean());

    _persistence.update(announcementsDelivery, false);

    return announcementsDelivery;
  }
  @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());
  }