public Set<GsonGroup> getGroups(String gitlabUrl, String token) {
    return Set.copyOf(executePaginatedQuery(gitlabUrl, token, "/groups", resp -> GSON.fromJson(resp, GITLAB_GROUP)));
  }
@Test
  public void getGroups_whenCallIsSuccessful_deserializesAndReturnsCorrectlyGroups() throws IOException {
    ArgumentCaptor<Function<String, List<GsonGroup>>> deserializerCaptor = ArgumentCaptor.forClass(Function.class);

    String token = "token-toto";
    GitlabToken gitlabToken = new GitlabToken(token);
    List<GsonGroup> expectedGroups = expectedGroups();
    when(gitlabPaginatedHttpClient.get(eq(gitlabUrl), eq(gitlabToken), eq("/groups"), deserializerCaptor.capture())).thenReturn(expectedGroups);

    Set<GsonGroup> groups = underTest.getGroups(gitlabUrl, token);
    assertThat(groups).containsExactlyInAnyOrderElementsOf(expectedGroups);

    String responseContent = getResponseContent("groups-full-response.json");

    List<GsonGroup> deserializedGroups = deserializerCaptor.getValue().apply(responseContent);
    assertThat(deserializedGroups).usingRecursiveComparison().isEqualTo(expectedGroups);
  }