|
8 | 8 | import io.getstream.core.models.EnrichedActivity; |
9 | 9 | import io.getstream.core.models.Group; |
10 | 10 | import io.getstream.core.options.EnrichmentFlags; |
| 11 | +import io.getstream.core.options.Limit; |
| 12 | +import io.getstream.core.options.Offset; |
11 | 13 |
|
| 14 | +import static org.junit.Assert.assertEquals; |
| 15 | + |
| 16 | +import java.net.URL; |
12 | 17 | import java.util.LinkedHashMap; |
13 | 18 | import java.util.List; |
14 | 19 | import java.util.Map; |
@@ -51,21 +56,31 @@ public void getEnrichedActivityGroups() throws Exception { |
51 | 56 |
|
52 | 57 | @Test |
53 | 58 | public void getEnrichedRankingVars() throws Exception { |
| 59 | + MockHTTPClient httpClient = new MockHTTPClient(); |
54 | 60 | Client client = |
55 | 61 | Client.builder(apiKey, secret) |
56 | | - .httpClient(new OKHTTPClientAdapter(new OkHttpClient())) |
| 62 | + .httpClient(httpClient) |
57 | 63 | .build(); |
58 | 64 |
|
59 | 65 | Map<String, Object> mp = new LinkedHashMap(); |
60 | 66 |
|
61 | | - mp.put("boolVal",true); |
62 | | - mp.put("music",1); |
63 | | - mp.put("sports",2.1); |
64 | | - mp.put("string","str"); |
| 67 | + mp.put("boolVal", true); |
| 68 | + mp.put("music", 1); |
| 69 | + mp.put("sports", 2.1); |
| 70 | + mp.put("string", "str"); |
65 | 71 |
|
66 | 72 | FlatFeed feed = client.flatFeed("flat", "1"); |
67 | 73 |
|
68 | | - List<EnrichedActivity> result = feed.getEnrichedActivities(new EnrichmentFlags().rankingVars(mp)).join(); |
| 74 | + List<EnrichedActivity> result = feed.getEnrichedActivities( |
| 75 | + new Limit(69), |
| 76 | + new Offset(13), |
| 77 | + new EnrichmentFlags().rankingVars(mp)).join(); |
| 78 | + |
| 79 | + URL feedURL = new URL( |
| 80 | + "https://us-east-api.stream-io-api.com:443/api/v1.0/enrich/feed/flat/1/?api_key=" |
| 81 | + + apiKey |
| 82 | + + "&limit=69&offset=13&ranking=rank&ranking_vars=%7B%22boolVal%22:true,%22music%22:1,%22sports%22:2.1,%22string%22:%22str%22%7D"); |
| 83 | + assertEquals(httpClient.lastRequest.getURL(), feedURL); |
69 | 84 | } |
70 | 85 |
|
71 | 86 | @Test |
|
0 commit comments