@Test
  public void testRequestGroupsInfo() throws Exception {
    List<Long> groupIds = Arrays.asList(1L, 2L, 3L);
    String requestGroupsLink = "requestGroupsLink";
    when(linkBuilder.getRequestGroupsLink(groupIds)).thenReturn(requestGroupsLink);
    String answer = "answer";
    when(request.get(requestGroupsLink, 200)).thenReturn(answer);
    when(jsonService.getGroups(answer)).thenReturn(new ArrayList<>());

    apiService.requestGroups(groupIds);

    verify(linkBuilder, times(1)).getRequestGroupsLink(groupIds);
    verify(request, times(1)).get(requestGroupsLink, 200);
    verify(jsonService, times(1)).getGroups(answer);
  }
  @Test
  public void testGetUserInfo() throws Exception {
    Long userId = 1L;
    String accessToken = "accessToken";
    String userInfoLink = "userInfoLink";
    when(linkBuilder.getUserInfoLink(userId, accessToken)).thenReturn(userInfoLink);
    String userInfoString = "userInfoString";
    when(request.get(userInfoLink, 200)).thenReturn(userInfoString);
    when(jsonService.getUserInfo(userInfoString)).thenReturn(new UserInfo());

    apiService.getUserInfo(userId, accessToken);

    verify(linkBuilder, times(1)).getUserInfoLink(userId, accessToken);
    verify(request, times(1)).get(userInfoLink, 200);
    verify(jsonService, times(1)).getUserInfo(userInfoString);
  }
  @Test
  public void testRequestGroupIds() throws Exception {
    long followerId = 1L;
    String accessToken = "accessToken";
    String requestGroupIdsLink = "requestGroupIdsLink";
    when(linkBuilder.getRequestGroupIdsLink(followerId, accessToken))
        .thenReturn(requestGroupIdsLink);
    String answer = "answer";
    when(request.get(requestGroupIdsLink, 0)).thenReturn(answer);
    when(jsonService.getGroupsIds(answer)).thenReturn(new ArrayList<>());

    apiService.requestGroupIds(followerId, accessToken);

    verify(linkBuilder, times(1)).getRequestGroupIdsLink(followerId, accessToken);
    verify(request, times(1)).get(requestGroupIdsLink, 0);
    verify(jsonService, times(1)).getGroupsIds(answer);
  }
  @Test
  public void testRequestAccessToken() throws Exception {
    String code = "code";
    String requestAccessTokenLink = "accessTokenLink";
    when(linkBuilder.getRequestAccessTokenLink(code)).thenReturn(requestAccessTokenLink);
    String answer = "answer";
    when(request.get(requestAccessTokenLink, 0)).thenReturn(answer);
    String accessToken = "accessToken";
    when(jsonService.getAccessToken(answer)).thenReturn(accessToken);

    String actualAccessToken = apiService.requestAccessToken(code);

    verify(linkBuilder, times(1)).getRequestAccessTokenLink(code);
    verify(request, times(1)).get(requestAccessTokenLink, 0);
    verify(jsonService, times(1)).getAccessToken(answer);
    assertEquals(accessToken, actualAccessToken);
  }
  @Test
  public void testResolveScreenName() throws Exception {
    String userLink = "https://vk.com/durov";
    String resolveScreenNameLink = "resolveScreenNameLink";
    String screenName = "durov";
    when(linkBuilder.getResolveScreenNameLink(screenName)).thenReturn(resolveScreenNameLink);
    String answer = "answer";
    when(request.get(resolveScreenNameLink, 0)).thenReturn(answer);
    Long id = 1L;
    when(jsonService.getFollowingId(answer)).thenReturn(id);

    Long actualId = apiService.resolveScreenName(userLink);

    verify(linkBuilder, times(1)).getResolveScreenNameLink(screenName);
    verify(request, times(1)).get(resolveScreenNameLink, 0);
    verify(jsonService, times(1)).getFollowingId(answer);
    assertEquals(id, actualId);
  }
  @Test
  public void testRequestLikedUserIds() throws Exception {
    Long groupId = 1L;
    Long postId = 1L;
    int count = 1;
    int offset = 0;
    String accessToken = "accessToken";
    String requestLikedUserIdsLink = "requestLikedUserIdsLink";
    when(linkBuilder.getRequestLikedUserIdsLink(groupId, postId, offset, accessToken))
        .thenReturn(requestLikedUserIdsLink);
    String answer = "answer";
    when(request.get(requestLikedUserIdsLink, 200)).thenReturn(answer);
    when(jsonService.getLikedUserIds(answer)).thenReturn(new HashSet<>());

    apiService.requestLikedUserIds(groupId, postId, count, accessToken);

    verify(linkBuilder, times(1)).getRequestLikedUserIdsLink(groupId, postId, offset, accessToken);
    verify(request, times(1)).get(requestLikedUserIdsLink, 200);
    verify(jsonService, times(1)).getLikedUserIds(answer);
  }