add NetUtil.isopen

This commit is contained in:
Looly
2020-04-19 09:38:17 +08:00
parent eaf1938433
commit f4fc97f9de
5 changed files with 56 additions and 6 deletions

View File

@@ -1,9 +1,9 @@
package cn.hutool.db;
import java.util.ArrayList;
import cn.hutool.core.util.PageUtil;
import java.util.ArrayList;
/**
* 分页数据结果集
*
@@ -169,6 +169,6 @@ public class PageResult<T> extends ArrayList<T> {
* @return 是否最后一页
*/
public boolean isLast() {
return this.page >= this.totalPage;
return this.page >= (this.totalPage - 1);
}
}

View File

@@ -0,0 +1,14 @@
package cn.hutool.db;
import org.junit.Assert;
import org.junit.Test;
public class PageResultTest {
@Test
public void isLastTest(){
// 每页2条共10条总共5页第一页是0最后一页应该是4
final PageResult<String> result = new PageResult<>(4, 2, 10);
Assert.assertTrue(result.isLast());
}
}