protected BookmarksFolder addBookmarksFolder() throws Exception { long pk = nextLong(); BookmarksFolder bookmarksFolder = _persistence.create(pk); bookmarksFolder.setUuid(randomString()); bookmarksFolder.setGroupId(nextLong()); bookmarksFolder.setCompanyId(nextLong()); bookmarksFolder.setUserId(nextLong()); bookmarksFolder.setUserName(randomString()); bookmarksFolder.setCreateDate(nextDate()); bookmarksFolder.setModifiedDate(nextDate()); bookmarksFolder.setParentFolderId(nextLong()); bookmarksFolder.setName(randomString()); bookmarksFolder.setDescription(randomString()); _persistence.update(bookmarksFolder, false); return bookmarksFolder; }
public void testUpdateExisting() throws Exception { long pk = nextLong(); BookmarksFolder newBookmarksFolder = _persistence.create(pk); newBookmarksFolder.setUuid(randomString()); newBookmarksFolder.setGroupId(nextLong()); newBookmarksFolder.setCompanyId(nextLong()); newBookmarksFolder.setUserId(nextLong()); newBookmarksFolder.setUserName(randomString()); newBookmarksFolder.setCreateDate(nextDate()); newBookmarksFolder.setModifiedDate(nextDate()); newBookmarksFolder.setParentFolderId(nextLong()); newBookmarksFolder.setName(randomString()); newBookmarksFolder.setDescription(randomString()); _persistence.update(newBookmarksFolder, false); BookmarksFolder existingBookmarksFolder = _persistence.findByPrimaryKey(newBookmarksFolder.getPrimaryKey()); assertEquals(existingBookmarksFolder.getUuid(), newBookmarksFolder.getUuid()); assertEquals(existingBookmarksFolder.getFolderId(), newBookmarksFolder.getFolderId()); assertEquals(existingBookmarksFolder.getGroupId(), newBookmarksFolder.getGroupId()); assertEquals(existingBookmarksFolder.getCompanyId(), newBookmarksFolder.getCompanyId()); assertEquals(existingBookmarksFolder.getUserId(), newBookmarksFolder.getUserId()); assertEquals(existingBookmarksFolder.getUserName(), newBookmarksFolder.getUserName()); assertEquals( Time.getShortTimestamp(existingBookmarksFolder.getCreateDate()), Time.getShortTimestamp(newBookmarksFolder.getCreateDate())); assertEquals( Time.getShortTimestamp(existingBookmarksFolder.getModifiedDate()), Time.getShortTimestamp(newBookmarksFolder.getModifiedDate())); assertEquals( existingBookmarksFolder.getParentFolderId(), newBookmarksFolder.getParentFolderId()); assertEquals(existingBookmarksFolder.getName(), newBookmarksFolder.getName()); assertEquals(existingBookmarksFolder.getDescription(), newBookmarksFolder.getDescription()); }