relationshipRepository.save(relationship);
}</BUG>
@Override
public void unfollow(Long userId) throws RelationshipNotFoundException {
final User followed = userRepository.findOne(userId);
<BUG>final User currentUser = securityContextService.currentUser();
final Relationship relationship = relationshipRepository
.findOneByFollowerAndFollowed(currentUser, followed)
.orElseThrow(RelationshipNotFoundException::new);

relationshipRepository.delete(relationship);</BUG>
}

relationshipRepository.save(relationship);
});
}
@Override
public void unfollow(Long userId) throws RelationshipNotFoundException {
final User followed = userRepository.findOne(userId);
final Optional<Relationship> relationship = securityContextService.currentUser()
.flatMap(currentUser -> relationshipRepository.findOneByFollowerAndFollowed(currentUser, followed));
relationship.ifPresent(relationshipRepository::delete);
relationship.orElseThrow(RelationshipNotFoundException::new);
}
