public static List<JCUser> usersListOf(int n) { List<JCUser> result = new ArrayList<>(n); for (int i = 0; i < n; i++) { result.add(persist(ObjectsFactory.getRandomUser())); } return result; } }
public static Post getDefaultPost() { return persist(new Post(persist(ObjectsFactory.getRandomUser()), "post content")); }
public static PostComment getModifiedPostComment() { PostComment comment3 = new PostComment(); comment3.setAuthor(persist(ObjectsFactory.getRandomUser())); comment3.setBody("Comment3 body"); comment3.setCreationDate(new DateTime(3)); comment3.setPost(getDefaultPost()); comment3.setUserChanged(persist(ObjectsFactory.getRandomUser())); comment3.setModificationDate(new DateTime(4)); return comment3; }
/** * Return first code review comment from persisted code review. * * @return first code review comment from persisted code review. */ public static PostComment getDefaultPostComment() { PostComment comment2 = new PostComment(); comment2.setAuthor(persist(ObjectsFactory.getRandomUser())); comment2.setBody("Comment2 body"); comment2.setCreationDate(new DateTime(2)); comment2.setPost(getDefaultPost()); return comment2; }
/** * Create the Topics with posts. * * @return saved topics */ public static List<Topic> createAndSaveTopicListWithPosts(int size) { org.jtalks.jcommune.model.entity.Branch branch = ObjectsFactory.getDefaultBranch(); JCUser user = persist(ObjectsFactory.getRandomUser()); for (int i = 0; i < size; i++) { Topic topic = new Topic(user, "title" + i, "Discussion"); topic.addPost(new Post(topic.getTopicStarter(), "content")); branch.addTopic(topic); } persist(branch); return branch.getTopics(); }