public SearchOptions setPage(int page, int pageSize) {
    checkArgument(page >= 1, "Page must be greater or equal to 1 (got " + page + ")");
    setLimit(pageSize);
    int lastResultIndex = page * pageSize;
    checkArgument(lastResultIndex <= MAX_RETURNABLE_RESULTS, "Can return only the first %s results. %sth result asked.", MAX_RETURNABLE_RESULTS, lastResultIndex);
    setOffset(lastResultIndex - pageSize);
    return this;
  }
@Test
  public void fail_if_result_after_first_10_000() {
    assertThatThrownBy(() -> underTest.setPage(21, 500))
      .isInstanceOf(IllegalArgumentException.class)
      .hasMessage("Can return only the first 10000 results. 10500th result asked.");
  }