mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
add test
This commit is contained in:
parent
d675b7376d
commit
3acf9c4e70
@ -17,20 +17,22 @@ import cn.hutool.log.StaticLog;
|
||||
*
|
||||
*/
|
||||
public class DbTest {
|
||||
|
||||
@Test
|
||||
public void queryTest() throws SQLException {
|
||||
List<Entity> find = Db.use().query("select * from user where age = ?", 18);
|
||||
Assert.assertEquals("王五", find.get(0).get("name"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findTest() throws SQLException {
|
||||
Db.use();
|
||||
|
||||
List<Entity> find = Db.use().find(Entity.create("user").set("age", 18));
|
||||
Assert.assertEquals("王五", find.get(0).get("name"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findByTest() throws SQLException {
|
||||
Db.use();
|
||||
|
||||
List<Entity> find = Db.use().findBy("user",
|
||||
List<Entity> find = Db.use().findBy("user",
|
||||
Condition.parse("age", "> 18"),
|
||||
Condition.parse("age", "< 100")
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user