Skip to content

Commit

Permalink
One more test for Limiter
Browse files Browse the repository at this point in the history
  • Loading branch information
amaembo committed Sep 2, 2023
1 parent 46fa336 commit ba20b9c
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/test/java/one/util/streamex/LimiterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,21 @@ public void testDirect() {
assertEquals(5, limiter.size());
Iterator<Integer> iterator = limiter.iterator();
assertEquals(Arrays.asList(1, 2, 3, 4, 5), StreamEx.of(iterator).toList());
}
}

@Test
public void testDirectPutAll() {
Limiter<Integer> limiter = new Limiter<>(3, Comparator.naturalOrder());
Limiter<Integer> limiter2 = new Limiter<>(3, Comparator.naturalOrder());
limiter.put(6);
limiter.put(5);
limiter.put(4);
limiter2.put(3);
limiter2.put(1);
limiter2.put(0);
Limiter<Integer> result = limiter.putAll(limiter2);
result.put(2);
result.sort();
System.out.println(result);
}
}

0 comments on commit ba20b9c

Please sign in to comment.