This commit is contained in:
Looly
2022-04-30 23:54:16 +08:00
parent a3d5385efc
commit 4613d47c84
7 changed files with 41 additions and 12 deletions

View File

@@ -36,12 +36,22 @@ public class DbTest {
// 测试数据库中一共4条数据第0页有3条第1页有1条
final List<Entity> page0 = Db.of().page(Entity.create("user"), Page.of(0, 3));
Assert.assertEquals(3, page0.size());
final List<Entity> page1 = Db.of().page(Entity.create("user"), Page.of(1, 3));
Assert.assertEquals(1, page1.size());
}
@Test
public void pageTest2() {
final long count = Db.of().count(Entity.create("user"), Page.of(1, 3));
Assert.assertEquals(1, count);
final List<Entity> page1 = Db.of().page(Entity.create("user"), Page.of(1, 3));
Assert.assertEquals(1, page1.size());
}
@Test
public void pageBySqlTest() {
final String sql = "select * from user order by name";
// 测试数据库中一共4条数据第0页有3条第1页有1条
final List<Entity> page0 = Db.of().page(