コード例 #1
0
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    Status newStatus = _persistence.create(pk);

    newStatus.setUserId(RandomTestUtil.nextLong());

    newStatus.setModifiedDate(RandomTestUtil.nextLong());

    newStatus.setOnline(RandomTestUtil.randomBoolean());

    newStatus.setAwake(RandomTestUtil.randomBoolean());

    newStatus.setActivePanelIds(RandomTestUtil.randomString());

    newStatus.setMessage(RandomTestUtil.randomString());

    newStatus.setPlaySound(RandomTestUtil.randomBoolean());

    _statuses.add(_persistence.update(newStatus));

    Status existingStatus = _persistence.findByPrimaryKey(newStatus.getPrimaryKey());

    Assert.assertEquals(existingStatus.getStatusId(), newStatus.getStatusId());
    Assert.assertEquals(existingStatus.getUserId(), newStatus.getUserId());
    Assert.assertEquals(existingStatus.getModifiedDate(), newStatus.getModifiedDate());
    Assert.assertEquals(existingStatus.getOnline(), newStatus.getOnline());
    Assert.assertEquals(existingStatus.getAwake(), newStatus.getAwake());
    Assert.assertEquals(existingStatus.getActivePanelIds(), newStatus.getActivePanelIds());
    Assert.assertEquals(existingStatus.getMessage(), newStatus.getMessage());
    Assert.assertEquals(existingStatus.getPlaySound(), newStatus.getPlaySound());
  }
コード例 #2
0
  protected Status addStatus() throws Exception {
    long pk = RandomTestUtil.nextLong();

    Status status = _persistence.create(pk);

    status.setUserId(RandomTestUtil.nextLong());

    status.setModifiedDate(RandomTestUtil.nextLong());

    status.setOnline(RandomTestUtil.randomBoolean());

    status.setAwake(RandomTestUtil.randomBoolean());

    status.setActivePanelIds(RandomTestUtil.randomString());

    status.setMessage(RandomTestUtil.randomString());

    status.setPlaySound(RandomTestUtil.randomBoolean());

    _statuses.add(_persistence.update(status));

    return status;
  }