@Test
  public void testFetchByPrimaryKeysWithOnePrimaryKey() throws Exception {
    Status newStatus = addStatus();

    Set<Serializable> primaryKeys = new HashSet<Serializable>();

    primaryKeys.add(newStatus.getPrimaryKey());

    Map<Serializable, Status> statuses = _persistence.fetchByPrimaryKeys(primaryKeys);

    Assert.assertEquals(1, statuses.size());
    Assert.assertEquals(newStatus, statuses.get(newStatus.getPrimaryKey()));
  }
  @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 testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist()
      throws Exception {
    Status newStatus = addStatus();

    long pk = RandomTestUtil.nextLong();

    Set<Serializable> primaryKeys = new HashSet<Serializable>();

    primaryKeys.add(newStatus.getPrimaryKey());
    primaryKeys.add(pk);

    Map<Serializable, Status> statuses = _persistence.fetchByPrimaryKeys(primaryKeys);

    Assert.assertEquals(1, statuses.size());
    Assert.assertEquals(newStatus, statuses.get(newStatus.getPrimaryKey()));
  }
  @Test
  public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereAllPrimaryKeysExist()
      throws Exception {
    Status newStatus1 = addStatus();
    Status newStatus2 = addStatus();

    Set<Serializable> primaryKeys = new HashSet<Serializable>();

    primaryKeys.add(newStatus1.getPrimaryKey());
    primaryKeys.add(newStatus2.getPrimaryKey());

    Map<Serializable, Status> statuses = _persistence.fetchByPrimaryKeys(primaryKeys);

    Assert.assertEquals(2, statuses.size());
    Assert.assertEquals(newStatus1, statuses.get(newStatus1.getPrimaryKey()));
    Assert.assertEquals(newStatus2, statuses.get(newStatus2.getPrimaryKey()));
  }
  @Test
  public void testFetchByPrimaryKeyExisting() throws Exception {
    Status newStatus = addStatus();

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

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

    _persistence.remove(newStatus);

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

    Assert.assertNull(existingStatus);
  }
  @Test
  public void testCreate() throws Exception {
    long pk = RandomTestUtil.nextLong();

    Status status = _persistence.create(pk);

    Assert.assertNotNull(status);

    Assert.assertEquals(status.getPrimaryKey(), pk);
  }
  @Test
  public void testResetOriginalValues() throws Exception {
    Status newStatus = addStatus();

    _persistence.clearCache();

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

    Assert.assertEquals(
        Long.valueOf(existingStatus.getUserId()),
        ReflectionTestUtil.<Long>invoke(existingStatus, "getOriginalUserId", new Class<?>[0]));
  }