@Test public void testUpdateExisting() throws Exception { long pk = RandomTestUtil.nextLong(); MeetupsRegistration newMeetupsRegistration = _persistence.create(pk); newMeetupsRegistration.setCompanyId(RandomTestUtil.nextLong()); newMeetupsRegistration.setUserId(RandomTestUtil.nextLong()); newMeetupsRegistration.setUserName(RandomTestUtil.randomString()); newMeetupsRegistration.setCreateDate(RandomTestUtil.nextDate()); newMeetupsRegistration.setModifiedDate(RandomTestUtil.nextDate()); newMeetupsRegistration.setMeetupsEntryId(RandomTestUtil.nextLong()); newMeetupsRegistration.setStatus(RandomTestUtil.nextInt()); newMeetupsRegistration.setComments(RandomTestUtil.randomString()); _meetupsRegistrations.add(_persistence.update(newMeetupsRegistration)); MeetupsRegistration existingMeetupsRegistration = _persistence.findByPrimaryKey(newMeetupsRegistration.getPrimaryKey()); Assert.assertEquals( existingMeetupsRegistration.getMeetupsRegistrationId(), newMeetupsRegistration.getMeetupsRegistrationId()); Assert.assertEquals( existingMeetupsRegistration.getCompanyId(), newMeetupsRegistration.getCompanyId()); Assert.assertEquals( existingMeetupsRegistration.getUserId(), newMeetupsRegistration.getUserId()); Assert.assertEquals( existingMeetupsRegistration.getUserName(), newMeetupsRegistration.getUserName()); Assert.assertEquals( Time.getShortTimestamp(existingMeetupsRegistration.getCreateDate()), Time.getShortTimestamp(newMeetupsRegistration.getCreateDate())); Assert.assertEquals( Time.getShortTimestamp(existingMeetupsRegistration.getModifiedDate()), Time.getShortTimestamp(newMeetupsRegistration.getModifiedDate())); Assert.assertEquals( existingMeetupsRegistration.getMeetupsEntryId(), newMeetupsRegistration.getMeetupsEntryId()); Assert.assertEquals( existingMeetupsRegistration.getStatus(), newMeetupsRegistration.getStatus()); Assert.assertEquals( existingMeetupsRegistration.getComments(), newMeetupsRegistration.getComments()); }
@Test public void testResetOriginalValues() throws Exception { MeetupsRegistration newMeetupsRegistration = addMeetupsRegistration(); _persistence.clearCache(); MeetupsRegistration existingMeetupsRegistration = _persistence.findByPrimaryKey(newMeetupsRegistration.getPrimaryKey()); Assert.assertEquals( Long.valueOf(existingMeetupsRegistration.getUserId()), ReflectionTestUtil.<Long>invoke( existingMeetupsRegistration, "getOriginalUserId", new Class<?>[0])); Assert.assertEquals( Long.valueOf(existingMeetupsRegistration.getMeetupsEntryId()), ReflectionTestUtil.<Long>invoke( existingMeetupsRegistration, "getOriginalMeetupsEntryId", new Class<?>[0])); }