@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());
  }
  @Test
  public void testDynamicQueryByPrimaryKeyExisting() throws Exception {
    Status newStatus = addStatus();

    DynamicQuery dynamicQuery =
        DynamicQueryFactoryUtil.forClass(Status.class, _dynamicQueryClassLoader);

    dynamicQuery.add(RestrictionsFactoryUtil.eq("statusId", newStatus.getStatusId()));

    List<Status> result = _persistence.findWithDynamicQuery(dynamicQuery);

    Assert.assertEquals(1, result.size());

    Status existingStatus = result.get(0);

    Assert.assertEquals(existingStatus, newStatus);
  }
  @Test
  public void testDynamicQueryByProjectionExisting() throws Exception {
    Status newStatus = addStatus();

    DynamicQuery dynamicQuery =
        DynamicQueryFactoryUtil.forClass(Status.class, _dynamicQueryClassLoader);

    dynamicQuery.setProjection(ProjectionFactoryUtil.property("statusId"));

    Object newStatusId = newStatus.getStatusId();

    dynamicQuery.add(RestrictionsFactoryUtil.in("statusId", new Object[] {newStatusId}));

    List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);

    Assert.assertEquals(1, result.size());

    Object existingStatusId = result.get(0);

    Assert.assertEquals(existingStatusId, newStatusId);
  }