mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
*/
|
||||
public class CRUDTest {
|
||||
|
||||
private static Db db = Db.use("test");
|
||||
private static final Db db = Db.use("test");
|
||||
|
||||
@Test
|
||||
public void findIsNullTest() throws SQLException {
|
||||
|
@@ -1,16 +1,15 @@
|
||||
package cn.hutool.db;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.db.handler.EntityListHandler;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* SqlRunner线程安全测试
|
||||
@@ -31,17 +30,14 @@ public class ConcurentTest {
|
||||
@Test
|
||||
public void findTest() {
|
||||
for(int i = 0; i < 10000; i++) {
|
||||
ThreadUtil.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<Entity> find;
|
||||
try {
|
||||
find = db.find(CollectionUtil.newArrayList("name AS name2"), Entity.create("user"), new EntityListHandler());
|
||||
} catch (SQLException e) {
|
||||
throw new DbRuntimeException(e);
|
||||
}
|
||||
Console.log(find);
|
||||
ThreadUtil.execute(() -> {
|
||||
List<Entity> find;
|
||||
try {
|
||||
find = db.find(CollectionUtil.newArrayList("name AS name2"), Entity.create("user"), new EntityListHandler());
|
||||
} catch (SQLException e) {
|
||||
throw new DbRuntimeException(e);
|
||||
}
|
||||
Console.log(find);
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -1,11 +1,9 @@
|
||||
package cn.hutool.db;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import cn.hutool.core.lang.func.VoidFunc1;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* 事务性数据库操作单元测试
|
||||
@@ -30,11 +28,6 @@ public class SessionTest {
|
||||
@Test
|
||||
@Ignore
|
||||
public void txTest() throws SQLException {
|
||||
Session.create("test").tx(new VoidFunc1<Session>() {
|
||||
@Override
|
||||
public void call(Session session) throws SQLException {
|
||||
session.update(Entity.create().set("age", 78), Entity.create("user").set("name", "unitTestUser"));
|
||||
}
|
||||
});
|
||||
Session.create("test").tx(session -> session.update(Entity.create().set("age", 78), Entity.create("user").set("name", "unitTestUser")));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user