public static <E> List<E> executePaginatedRequest(String request, OAuth20Service scribe, OAuth2AccessToken accessToken, Function<String, List<E>> function) {
    List<E> result = new ArrayList<>();
    readPage(result, scribe, accessToken, addPerPageQueryParameter(request, DEFAULT_PAGE_SIZE), function);
    return result;
  }
@Test
  public void fail_to_executed_paginated_request() {
    mockWebServer.enqueue(new MockResponse()
      .setHeader("Link", "<" + serverUrl + "/test?per_page=100&page=2>; rel=\"next\", <" + serverUrl + "/test?per_page=100&page=2>; rel=\"last\"")
      .setBody("A"));
    mockWebServer.enqueue(new MockResponse().setResponseCode(404).setBody("Error!"));

    assertThatThrownBy(() -> executePaginatedRequest(serverUrl + "/test", oAuth20Service, auth2AccessToken, Arrays::asList))
      .isInstanceOf(IllegalStateException.class)
      .hasMessage(format("Fail to execute request '%s/test?per_page=100&page=2'. HTTP code: 404, response: Error!", serverUrl));
  }