public void testDiscussionPostsDataOfId() throws Exception {
Forum forum = this.forumAggregate();
DomainRegistry.forumRepository().save(forum);
Discussion discussion = this.discussionAggregate(forum);
DomainRegistry.discussionRepository().save(discussion);
Post[] posts = this.postAggregates(discussion);
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());