"A forum description.",
null);
DomainRegistry.forumRepository().save(forum);
Discussion discussion = this.discussionAggregate(forum);
DomainRegistry.discussionRepository().save(discussion);
DiscussionCommandResult result = new DiscussionCommandResult() {
@Override
public void resultingDiscussionId(String aDiscussionId) {
discussionId = aDiscussionId;
}
@Override
public void resultingPostId(String aPostId) {
postId = aPostId;
}
@Override
public void resultingInReplyToPostId(String aReplyToPostId) {
throw new UnsupportedOperationException("Should not be reached.");
}
};
discussionApplicationService
.postToDiscussion(
discussion.tenant().id(),
discussion.discussionId().id(),
"authorId1",
"Post Test",
"Post test text...",
result);
postApplicationService
.moderatePost(
discussion.tenant().id(),
forum.forumId().id(),
postId,
forum.moderator().identity(),
"Post Moderated Subject Test",
"Post moderated text test...");
Post post =
DomainRegistry
.postRepository()
.postOfId(
discussion.tenant(),
new PostId(postId));
assertNotNull(discussionId);
assertNotNull(post);
assertEquals("Post Moderated Subject Test", post.subject());