|
@@ -0,0 +1,27 @@
|
|
|
|
+package com.qmth.boot.test.tools.iterator;
|
|
|
|
+
|
|
|
|
+import com.qmth.boot.tools.iterator.PageListIterator;
|
|
|
|
+import org.junit.Assert;
|
|
|
|
+import org.junit.Test;
|
|
|
|
+
|
|
|
|
+import java.util.Collection;
|
|
|
|
+import java.util.Collections;
|
|
|
|
+
|
|
|
|
+public class PageListIteratorTest {
|
|
|
|
+
|
|
|
|
+ @Test
|
|
|
|
+ public void test() {
|
|
|
|
+ PageListIterator<Integer> iterator = new PageListIterator<Integer>(1) {
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Collection<Integer> getPageList(int pageNumber, int pageSize) {
|
|
|
|
+ return Collections.singletonList(pageNumber);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ for (int i = 1; i <= 10; i++) {
|
|
|
|
+ Assert.assertTrue(iterator.hasNext());
|
|
|
|
+ Assert.assertEquals((int) iterator.next(), i);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|