### Question:
TransactionalTopicModificationService implements TopicModificationService, PluginTopicModificationService { @PreAuthorize("hasPermission(#topic.branch.id, 'BRANCH', 'BranchPermission.CLOSE_TOPICS')") @Override public void openTopic(Topic topic) { topic.setClosed(false); dao.saveOrUpdate(topic); } TransactionalTopicModificationService(TopicDao dao, SecurityService securityService,
                                                 BranchDao branchDao,
                                                 NotificationService notificationService,
                                                 SubscriptionService subscriptionService,
                                                 UserService userService,
                                                 PollService pollService,
                                                 SecurityContextFacade securityContextFacade,
                                                 PermissionEvaluator permissionEvaluator,
                                                 BranchLastPostService branchLastPostService,
                                                 LastReadPostService lastReadPostService,
                                                 PostDao postDao,
                                                 TopicFetchService topicFetchService,
                                                 TopicDraftService topicDraftService,
                                                 PluginLoader pluginLoader); @Override @PreAuthorize("hasPermission(#branchId, 'BRANCH', 'BranchPermission.CREATE_POSTS')") Post replyToTopic(long topicId, String answerBody, long branchId); @Override @PreAuthorize("( (not #topicDto.codeReview) and (not #topicDto.plugable) " + "and hasPermission(#topicDto.branch.id, 'BRANCH', 'BranchPermission.CREATE_POSTS')) " + "or (#topicDto.codeReview " + "and hasPermission(#topicDto.branch.id, 'BRANCH', 'BranchPermission.CREATE_CODE_REVIEW')) " + " or #topicDto.plugable") //we check permission for plugable topic creation inside method Topic createTopic(Topic topicDto, String bodyText); @Override @PreAuthorize("(hasPermission(#topic.id, 'TOPIC', 'GeneralPermission.WRITE') and " + "hasPermission(#topic.branch.id, 'BRANCH', 'BranchPermission.EDIT_OWN_POSTS')) or " + "(not hasPermission(#topic.id, 'TOPIC', 'GeneralPermission.WRITE') and " + "hasPermission(#topic.branch.id, 'BRANCH', 'BranchPermission.EDIT_OTHERS_POSTS'))") void updateTopic(Topic topic, Poll poll); @PreAuthorize("(hasPermission(#topic.branch.id, 'BRANCH', 'BranchPermission.DELETE_OWN_POSTS') and " + "#topic.containsOwnerPostsOnly and #topic.topicStarter.id == principal.id) or " + "(hasPermission(#topic.branch.id, 'BRANCH', 'BranchPermission.DELETE_OTHERS_POSTS') and " + "hasPermission(#topic.branch.id, 'BRANCH', 'BranchPermission.DELETE_OWN_POSTS'))") @Override void deleteTopic(Topic topic); @Override void deleteTopicSilent(long topicId); @PreAuthorize("hasPermission(#topic.branch.id, 'BRANCH', 'BranchPermission.MOVE_TOPICS')") @Override void moveTopic(Topic topic, Long branchId); @PreAuthorize("hasPermission(#topic.branch.id, 'BRANCH', 'BranchPermission.CLOSE_TOPICS')") @Override void closeTopic(Topic topic); @PreAuthorize("hasPermission(#topic.branch.id, 'BRANCH', 'BranchPermission.CLOSE_TOPICS')") @Override void openTopic(Topic topic);  }### Answer:
@Test public void testOpenTopic() { Topic topic = this.createTopic(); topic.setClosed(true); topicService.openTopic(topic); assertFalse(topic.isClosed()); verify(topicDao).saveOrUpdate(topic); }