Skip to content

2.x: add limit() to limit both item count and request amount #5655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 18, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address some feedback.
  • Loading branch information
akarnokd committed Oct 10, 2017
commit 76e09acb36b4a8db382ca52fd3c70964ec042223
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@

public class FlowableLimitTest implements LongConsumer, Action {

final List<Long> requests = Collections.synchronizedList(new ArrayList<Long>());
final List<Long> requests = new ArrayList<Long>();

static final Long CANCELLED = -100L;

@Override
public void accept(long t) throws Exception {
Expand All @@ -39,7 +41,7 @@ public void accept(long t) throws Exception {

@Override
public void run() throws Exception {
requests.add(-100L);
requests.add(CANCELLED);
}

@Test
Expand Down Expand Up @@ -130,7 +132,7 @@ public void limitAndTake() {
.test()
.assertResult(1, 2, 3, 4, 5);

assertEquals(Arrays.asList(6L, -100L), requests);
assertEquals(Arrays.asList(6L, CANCELLED), requests);
}

@Test
Expand Down