for (Post post : posts) {
DomainRegistry.postRepository().save(post);
}
DiscussionPostsData discussionPostsData =
discussionQueryService.discussionPostsDataOfId(
discussion.tenant().id(), discussion.discussionId().id());
assertNotNull(discussionPostsData);
assertEquals(discussion.discussionId().id(), discussionPostsData.getDiscussionId());
assertEquals(discussion.forumId().id(), discussionPostsData.getForumId());
assertEquals(discussion.tenant().id(), discussionPostsData.getTenantId());
assertEquals(discussion.author().emailAddress(), discussionPostsData.getAuthorEmailAddress());
assertEquals(discussion.author().identity(), discussionPostsData.getAuthorIdentity());
assertEquals(discussion.author().name(), discussionPostsData.getAuthorName());
assertEquals(discussion.subject(), discussionPostsData.getSubject());
assertEquals(discussion.exclusiveOwner(), discussionPostsData.getExclusiveOwner());
assertEquals(discussion.isClosed(), discussionPostsData.isClosed());
assertNotNull(discussionPostsData.getPosts());
assertFalse(discussionPostsData.getPosts().isEmpty());
assertEquals(posts.length, discussionPostsData.getPosts().size());
for (PostData post : discussionPostsData.getPosts()) {
assertNotNull(post.getAuthorEmailAddress());
assertNotNull(post.getAuthorName());
assertNotNull(post.getBodyText());
assertNotNull(post.getSubject());
assertTrue(post.getAuthorIdentity().equals("jdoe") ||