@Test
void checkPagination() {

    final PaginatedApi<S, T> p = spy(new PaginatedApi<>(null, null, null, mock(ResteasyClient.class)));
    doReturn(null).when(p)
        .execute(any(), any(), any());
    final Function<T, List<S>> f = o -> Collections.emptyList();
    final Select sel = mock(Select.class);
    final int total = 1000;
    final RoboZonkyFilter filter = mock(RoboZonkyFilter.class);
    when(filter.getLastResponseHeader(eq("X-Total")))
        .thenReturn(Optional.of("" + total));
    final PaginatedResult<S> result = p.execute(f, sel, 1, 10, filter);
    assertThat(result.getTotalResultCount()).isEqualTo(total);
    verify(filter, never()).setRequestHeader(eq("X-Order"), any());
    verify(filter).setRequestHeader(eq("X-Size"), eq("10"));
    verify(filter).setRequestHeader(eq("X-Page"), eq("1"));
    verify(p).execute(eq(f), eq(sel), eq(filter));
}