Пример #1
0
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = ServiceTestUtil.nextLong();

    PollsVote newPollsVote = _persistence.create(pk);

    newPollsVote.setUuid(ServiceTestUtil.randomString());

    newPollsVote.setGroupId(ServiceTestUtil.nextLong());

    newPollsVote.setCompanyId(ServiceTestUtil.nextLong());

    newPollsVote.setUserId(ServiceTestUtil.nextLong());

    newPollsVote.setUserName(ServiceTestUtil.randomString());

    newPollsVote.setCreateDate(ServiceTestUtil.nextDate());

    newPollsVote.setModifiedDate(ServiceTestUtil.nextDate());

    newPollsVote.setQuestionId(ServiceTestUtil.nextLong());

    newPollsVote.setChoiceId(ServiceTestUtil.nextLong());

    newPollsVote.setVoteDate(ServiceTestUtil.nextDate());

    _persistence.update(newPollsVote);

    PollsVote existingPollsVote = _persistence.findByPrimaryKey(newPollsVote.getPrimaryKey());

    Assert.assertEquals(existingPollsVote.getUuid(), newPollsVote.getUuid());
    Assert.assertEquals(existingPollsVote.getVoteId(), newPollsVote.getVoteId());
    Assert.assertEquals(existingPollsVote.getGroupId(), newPollsVote.getGroupId());
    Assert.assertEquals(existingPollsVote.getCompanyId(), newPollsVote.getCompanyId());
    Assert.assertEquals(existingPollsVote.getUserId(), newPollsVote.getUserId());
    Assert.assertEquals(existingPollsVote.getUserName(), newPollsVote.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingPollsVote.getCreateDate()),
        Time.getShortTimestamp(newPollsVote.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingPollsVote.getModifiedDate()),
        Time.getShortTimestamp(newPollsVote.getModifiedDate()));
    Assert.assertEquals(existingPollsVote.getQuestionId(), newPollsVote.getQuestionId());
    Assert.assertEquals(existingPollsVote.getChoiceId(), newPollsVote.getChoiceId());
    Assert.assertEquals(
        Time.getShortTimestamp(existingPollsVote.getVoteDate()),
        Time.getShortTimestamp(newPollsVote.getVoteDate()));
  }