Skip to content

Commit

Permalink
Fix StatsCollector / Mockito issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Griffin committed Nov 1, 2024
1 parent 7f6b730 commit a13a086
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/test/java/com/fauna/client/FeedIteratorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private CompletableFuture<FeedPage<String>> successFuture(boolean after, int num
"cursor0", System.currentTimeMillis() - 5,
num + "-b", null, null));

return CompletableFuture.supplyAsync(() -> FeedPage.builder(codec, client.getStatsCollector()).events(events).cursor("cursor0").hasNext(after).build());
return CompletableFuture.supplyAsync(() -> FeedPage.builder(codec, new StatsCollectorImpl()).events(events).cursor("cursor0").hasNext(after).build());
}

private CompletableFuture<FeedPage<String>> failureFuture() throws IOException {
Expand Down Expand Up @@ -91,8 +91,7 @@ public void test_single_page_without_calling_hasNext() throws IOException {

@Test
public void test_multiple_pages() throws IOException {
when(client.poll(argThat(source::equals), argThat(FeedOptions.DEFAULT::equals), any(Class.class))).thenReturn(successFuture(true, 0));
when(client.poll(argThat(source::equals), argThat(opts -> opts.getCursor().orElse("").equals(CURSOR_0)), any(Class.class))).thenReturn(successFuture(false, 1));
when(client.poll(argThat(source::equals), any(), any(Class.class))).thenReturn(successFuture(true, 0), successFuture(false, 1));
FeedIterator<String> feedIterator = new FeedIterator<>(client, source, FeedOptions.DEFAULT, String.class);

assertTrue(feedIterator.hasNext());
Expand Down

0 comments on commit a13a086

Please sign in to comment.