1
2
3
4
5 package com.jcabi.github;
6
7 import com.jcabi.http.request.FakeRequest;
8 import jakarta.json.Json;
9 import org.hamcrest.MatcherAssert;
10 import org.hamcrest.Matchers;
11 import org.junit.jupiter.api.Test;
12
13
14
15
16
17 final class RtSearchPaginationTest {
18
19 @Test
20 void iteratesItems() {
21 final String key = "key";
22 final String value = "value";
23 final Iterable<String> pagination = new RtSearchPagination<>(
24 new FakeRequest().withBody(
25 Json.createObjectBuilder().add(
26 "items", Json.createArrayBuilder().add(
27 Json.createObjectBuilder().add(key, value)
28 )
29 ).build().toString()
30 ),
31 "/search/path", "keywords", "sort", "order",
32 object -> object.getString(key)
33 );
34 MatcherAssert.assertThat(
35 "Values are not equal",
36 pagination.iterator().next(), Matchers.equalTo(value)
37 );
38 }
39
40 }