@Test public void testFollowAccount() throws Exception { final User user = UserServiceFactory.getUserService().getCurrentUser(); AccountShardService shardService = AccountShardService.create(); relationshipController.follow(following.getWebsafeId(), user); assertEquals(1, shardService.merge(follower).blockingSingle().getFollowingCount()); assertEquals(1, shardService.merge(following).blockingSingle().getFollowerCount()); Relationship relationship = ofy().load().type(Relationship.class).ancestor(follower.getKey()).first().now(); assertEquals(follower.getKey(), relationship.getFollowerKey()); assertEquals(following.getKey(), relationship.getFollowingKey()); assertEquals(1, ofy().load().type(Relationship.class).ancestor(follower.getKey()).count()); }
private Relationship followAccount(Key<Account> followerKey, Key<Account> followingKey) { return Relationship.builder().followerKey(followerKey).followingKey(followingKey).build(); }
RelationshipController extends Controller { private Relationship followAccount(Key<Account> followerKey, Key<Account> followingKey) { return Relationship.builder().followerKey(followerKey).followingKey(followingKey).build(); } }
RelationshipController extends Controller { private Relationship followAccount(Key<Account> followerKey, Key<Account> followingKey) { return Relationship.builder().followerKey(followerKey).followingKey(followingKey).build(); }  }
RelationshipController extends Controller { private Relationship followAccount(Key<Account> followerKey, Key<Account> followingKey) { return Relationship.builder().followerKey(followerKey).followingKey(followingKey).build(); }  void follow(String followingId, User user); void unfollow(String followingId, User user); CollectionResponse<Account> list(String accountId, RelationshipType type,
      Optional<Integer> limit, Optional<String> cursor); }
RelationshipController extends Controller { private Relationship followAccount(Key<Account> followerKey, Key<Account> followingKey) { return Relationship.builder().followerKey(followerKey).followingKey(followingKey).build(); }  void follow(String followingId, User user); void unfollow(String followingId, User user); CollectionResponse<Account> list(String accountId, RelationshipType type,
      Optional<Integer> limit, Optional<String> cursor);  }