Пример #1
0
  protected PollsVote addPollsVote() throws Exception {
    long pk = ServiceTestUtil.nextLong();

    PollsVote pollsVote = _persistence.create(pk);

    pollsVote.setUuid(ServiceTestUtil.randomString());

    pollsVote.setGroupId(ServiceTestUtil.nextLong());

    pollsVote.setCompanyId(ServiceTestUtil.nextLong());

    pollsVote.setUserId(ServiceTestUtil.nextLong());

    pollsVote.setUserName(ServiceTestUtil.randomString());

    pollsVote.setCreateDate(ServiceTestUtil.nextDate());

    pollsVote.setModifiedDate(ServiceTestUtil.nextDate());

    pollsVote.setQuestionId(ServiceTestUtil.nextLong());

    pollsVote.setChoiceId(ServiceTestUtil.nextLong());

    pollsVote.setVoteDate(ServiceTestUtil.nextDate());

    _persistence.update(pollsVote);

    return pollsVote;
  }
Пример #2
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()));
  }