@Test
void importPackageTest() {

    TableInfo tableInfo;
    StrategyConfig strategyConfig;
    tableInfo = new TableInfo().setName("user");
    tableInfo.importPackage(new StrategyConfig(), new GlobalConfig());
    Assertions.assertEquals(1, tableInfo.getImportPackages().size());
    Assertions.assertTrue(tableInfo.getImportPackages().contains(Serializable.class.getName()));
    tableInfo = new TableInfo().setName("user").setConvert(true);
    tableInfo.importPackage(new StrategyConfig(), new GlobalConfig());
    Assertions.assertEquals(2, tableInfo.getImportPackages().size());
    Assertions.assertTrue(tableInfo.getImportPackages().contains(Serializable.class.getName()));
    Assertions.assertTrue(tableInfo.getImportPackages().contains(TableName.class.getName()));
    tableInfo = new TableInfo().setName("user");
    strategyConfig = new StrategyConfig();
    tableInfo.importPackage(strategyConfig.setSuperEntityClass("con.baomihua.demo.SuperEntity"), new GlobalConfig());
    Assertions.assertEquals(1, tableInfo.getImportPackages().size());
    Assertions.assertFalse(tableInfo.getImportPackages().contains(Serializable.class.getName()));
    Assertions.assertTrue(tableInfo.getImportPackages().contains("con.baomihua.demo.SuperEntity"));
    tableInfo = new TableInfo().setName("user");
    strategyConfig = new StrategyConfig();
    tableInfo.importPackage(strategyConfig, new GlobalConfig().setActiveRecord(true));
    Assertions.assertEquals(1, tableInfo.getImportPackages().size());
    Assertions.assertFalse(tableInfo.getImportPackages().contains(Serializable.class.getName()));
    Assertions.assertTrue(tableInfo.getImportPackages().contains(Model.class.getName()));
    strategyConfig = new StrategyConfig();
    tableInfo = new TableInfo().setName("user");
    tableInfo.addFields(new TableField().setName("u_id").setPropertyName(strategyConfig, "uid").setColumnType(DbColumnType.LONG).setKeyFlag(true));
    tableInfo.importPackage(strategyConfig, new GlobalConfig());
    Assertions.assertEquals(2, tableInfo.getImportPackages().size());
    Assertions.assertTrue(tableInfo.getImportPackages().contains(Serializable.class.getName()));
    Assertions.assertTrue(tableInfo.getImportPackages().contains(TableId.class.getName()));
    strategyConfig = new StrategyConfig();
    tableInfo = new TableInfo().setName("user");
    tableInfo.addFields(new TableField().setName("u_id").setPropertyName(strategyConfig, "uid").setColumnType(DbColumnType.LONG).setKeyFlag(true).setKeyIdentityFlag(true));
    tableInfo.importPackage(strategyConfig, new GlobalConfig());
    Assertions.assertEquals(3, tableInfo.getImportPackages().size());
    Assertions.assertTrue(tableInfo.getImportPackages().contains(Serializable.class.getName()));
    Assertions.assertTrue(tableInfo.getImportPackages().contains(TableId.class.getName()));
    Assertions.assertTrue(tableInfo.getImportPackages().contains(IdType.class.getName()));
    strategyConfig = new StrategyConfig().setLogicDeleteFieldName("delete_flag");
    tableInfo = new TableInfo().setName("user");
    tableInfo.addFields(new TableField().setName("u_id").setPropertyName(strategyConfig, "uid").setColumnType(DbColumnType.LONG).setKeyFlag(true));
    tableInfo.addFields(new TableField().setName("delete_flag").setPropertyName(strategyConfig, "deleteFlag").setColumnType(DbColumnType.BOOLEAN));
    tableInfo.importPackage(strategyConfig, new GlobalConfig());
    Assertions.assertEquals(4, tableInfo.getImportPackages().size());
    Assertions.assertTrue(tableInfo.getImportPackages().contains(Serializable.class.getName()));
    Assertions.assertTrue(tableInfo.getImportPackages().contains(com.baomidou.mybatisplus.annotation.TableField.class.getName()));
    Assertions.assertTrue(tableInfo.getImportPackages().contains(TableLogic.class.getName()));
    Assertions.assertTrue(tableInfo.getImportPackages().contains(TableId.class.getName()));
    tableInfo = new TableInfo().setName("user");
    tableInfo.addFields(new TableField().setName("name").setPropertyName(strategyConfig, "name").setColumnType(DbColumnType.STRING));
    tableInfo.importPackage(new StrategyConfig(), new GlobalConfig().setIdType(IdType.ASSIGN_ID));
    Assertions.assertEquals(1, tableInfo.getImportPackages().size());
    Assertions.assertTrue(tableInfo.getImportPackages().contains(Serializable.class.getName()));
    tableInfo = new TableInfo().setName("user").setHavePrimaryKey(true);
    tableInfo.addFields(new TableField().setName("u_id").setPropertyName(strategyConfig, "uid").setColumnType(DbColumnType.LONG).setKeyFlag(true));
    tableInfo.importPackage(new StrategyConfig(), new GlobalConfig().setIdType(IdType.ASSIGN_ID));
    Assertions.assertEquals(3, tableInfo.getImportPackages().size());
    Assertions.assertTrue(tableInfo.getImportPackages().contains(Serializable.class.getName()));
    Assertions.assertTrue(tableInfo.getImportPackages().contains(TableId.class.getName()));
    Assertions.assertTrue(tableInfo.getImportPackages().contains(IdType.class.getName()));
    tableInfo = new TableInfo().setName("user").setHavePrimaryKey(true);
    tableInfo.addFields(new TableField().setName("u_id").setPropertyName(strategyConfig, "uid").setColumnType(DbColumnType.LONG).setKeyFlag(true));
    tableInfo.addFields(new TableField().setName("create_time").setPropertyName(strategyConfig, "createTime").setColumnType(DbColumnType.DATE).setFill(FieldFill.DEFAULT.name()));
    tableInfo.importPackage(new StrategyConfig().addTableFills(new TableFill("createTime", FieldFill.DEFAULT)), new GlobalConfig());
    Assertions.assertEquals(5, tableInfo.getImportPackages().size());
    Assertions.assertTrue(tableInfo.getImportPackages().contains(Date.class.getName()));
    Assertions.assertTrue(tableInfo.getImportPackages().contains(Serializable.class.getName()));
    Assertions.assertTrue(tableInfo.getImportPackages().contains(TableId.class.getName()));
    Assertions.assertTrue(tableInfo.getImportPackages().contains(com.baomidou.mybatisplus.annotation.TableField.class.getName()));
    Assertions.assertTrue(tableInfo.getImportPackages().contains(FieldFill.class.getName()));
    tableInfo = new TableInfo().setName("user").setHavePrimaryKey(true);
    tableInfo.addFields(new TableField().setName("u_id").setPropertyName(strategyConfig, "uid").setColumnType(DbColumnType.LONG).setKeyFlag(true));
    tableInfo.addFields(new TableField().setName("version").setPropertyName(strategyConfig, "version").setColumnType(DbColumnType.LONG));
    tableInfo.importPackage(new StrategyConfig().setVersionFieldName("version"), new GlobalConfig());
    Assertions.assertEquals(3, tableInfo.getImportPackages().size());
    Assertions.assertTrue(tableInfo.getImportPackages().contains(Serializable.class.getName()));
    Assertions.assertTrue(tableInfo.getImportPackages().contains(TableId.class.getName()));
    Assertions.assertTrue(tableInfo.getImportPackages().contains(Version.class.getName()));
}