@Test public void testUpdateExisting() throws Exception { long pk = RandomTestUtil.nextLong(); PasswordTracker newPasswordTracker = _persistence.create(pk); newPasswordTracker.setMvccVersion(RandomTestUtil.nextLong()); newPasswordTracker.setCompanyId(RandomTestUtil.nextLong()); newPasswordTracker.setUserId(RandomTestUtil.nextLong()); newPasswordTracker.setCreateDate(RandomTestUtil.nextDate()); newPasswordTracker.setPassword(RandomTestUtil.randomString()); _passwordTrackers.add(_persistence.update(newPasswordTracker)); PasswordTracker existingPasswordTracker = _persistence.findByPrimaryKey(newPasswordTracker.getPrimaryKey()); Assert.assertEquals( existingPasswordTracker.getMvccVersion(), newPasswordTracker.getMvccVersion()); Assert.assertEquals( existingPasswordTracker.getPasswordTrackerId(), newPasswordTracker.getPasswordTrackerId()); Assert.assertEquals(existingPasswordTracker.getCompanyId(), newPasswordTracker.getCompanyId()); Assert.assertEquals(existingPasswordTracker.getUserId(), newPasswordTracker.getUserId()); Assert.assertEquals( Time.getShortTimestamp(existingPasswordTracker.getCreateDate()), Time.getShortTimestamp(newPasswordTracker.getCreateDate())); Assert.assertEquals(existingPasswordTracker.getPassword(), newPasswordTracker.getPassword()); }
protected PasswordTracker addPasswordTracker() throws Exception { long pk = RandomTestUtil.nextLong(); PasswordTracker passwordTracker = _persistence.create(pk); passwordTracker.setMvccVersion(RandomTestUtil.nextLong()); passwordTracker.setCompanyId(RandomTestUtil.nextLong()); passwordTracker.setUserId(RandomTestUtil.nextLong()); passwordTracker.setCreateDate(RandomTestUtil.nextDate()); passwordTracker.setPassword(RandomTestUtil.randomString()); _passwordTrackers.add(_persistence.update(passwordTracker)); return passwordTracker; }