mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
@@ -13,13 +13,13 @@ import cn.hutool.db.ds.DSFactory;
|
||||
|
||||
/**
|
||||
* 元数据信息单元测试
|
||||
*
|
||||
*
|
||||
* @author Looly
|
||||
*
|
||||
*/
|
||||
public class MetaUtilTest {
|
||||
DataSource ds = DSFactory.get("test");
|
||||
|
||||
|
||||
@Test
|
||||
public void getTablesTest() {
|
||||
List<String> tables = MetaUtil.getTables(ds);
|
||||
@@ -31,10 +31,16 @@ public class MetaUtilTest {
|
||||
Table table = MetaUtil.getTableMeta(ds, "user");
|
||||
Assert.assertEquals(CollectionUtil.newHashSet("id"), table.getPkNames());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getColumnNamesTest() {
|
||||
String[] names = MetaUtil.getColumnNames(ds, "user");
|
||||
Assert.assertArrayEquals(StrUtil.splitToArray("id,name,age,birthday,gender", ','), names);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getTableIndexInfoTest() {
|
||||
Table table = MetaUtil.getTableMeta(ds, "user_1");
|
||||
Assert.assertEquals(table.getIndexInfoList().size(), 2);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user