/** * Makes the current user to unwatch a specific topic * * @param topicId the id of the topic to unwatch */ @SecurityConstraint(value = AuthenticatedRule.class, displayLogin = true) public void unwatch(long topicId) { Topic topic = new Topic(); topic.setId(topicId); this.watchService.unwatch(topic, userSession.getUser()); this.result.redirectTo(this).list(topicId); }
/** * Makes the current logged user watch a specific topic. * * @param topicId the id of the topic to watch */ @SecurityConstraint(value = AuthenticatedRule.class, displayLogin = true) public void watch(long topicId) { Topic topic = new Topic(); topic.setId(topicId); UserSession userSession = this.userSession; this.watchService.watch(topic, userSession.getUser()); this.result.redirectTo(Actions.LIST + "/" + topicId); }
@Test public void deleted() { final Topic topic = new Topic(); topic.setId(2); context.checking( new Expectations() { { one(repository).removeSubscription(topic); } }); event.deleted(topic); context.assertIsSatisfied(); }