TagMembershipService { public boolean unfollowTag(Tag tag) { log.debug("Removing followed tag : {}", tag); User currentUser = authenticationService.getCurrentUser(); boolean tagAlreadyFollowed = false; for (String alreadyFollowingTest : userTagRepository.findTags(currentUser.getLogin())) { if (alreadyFollowingTest.equals(tag.getName())) { tagAlreadyFollowed = true; } } if (tagAlreadyFollowed) { String domain = DomainUtil.getDomainFromLogin(currentUser.getLogin()); userTagRepository.removeTag(currentUser.getLogin(), tag.getName()); tagFollowerRepository.removeFollower(domain, tag.getName(), currentUser.getLogin()); log.debug("User " + currentUser.getLogin() + " has stopped following tag " + tag); return true; } else { return false; } }  boolean followTag(Tag tag); boolean unfollowTag(Tag tag);  }
@Test public void shouldNotUnfollowUnknownTag() { mockAuthentication("uuser@ippon.fr"); Tag tag = new Tag(); tag.setName("test"); assertFalse(tagMembershipService.unfollowTag(tag)); }