<dataset>
<user id="1" created_date='2017-01-01 00:00:00' email="" user_name="root"/>
</dataset>
XML上面给我错误。问题是我为用户保留了一句话。我该如何解决这个问题。有链接吗?
更新
我正在使用弹簧靴,弹簧数据JPA,春季测试 - 绑架,dbunit,postgresql
根据此论坛https://sourceforge.net/p/dbunit/mailman/message/message/20643023/似乎并没有dbunit可以"引用"表名称。但是,如果由于某种原因不想重命名表或使用Legacy Database
,则可以配置DatabaseDataSourceConnectionFactoryBean
。 @Configuration
public class Custom.... {
@Autowired
private DataSource dataSource;
@Bean
public DatabaseConfigBean dbUnitDatabaseConfig() {
DatabaseConfigBean dbConfigBean = new DatabaseConfigBean();
// dbConfigBean.setDatatypeFactory(new PostgresqlDataTypeFactory());
dbConfigBean.setQualifiedTableNames(true);
return dbConfigBean;
}
@Bean
public DatabaseDataSourceConnectionFactoryBean dbUnitDatabaseConnection() {
DatabaseDataSourceConnectionFactoryBean databaseDataSourceConnectionFactoryBean = new DatabaseDataSourceConnectionFactoryBean(dataSource);
databaseDataSourceConnectionFactoryBean.setDatabaseConfig(dbUnitDatabaseConfig());
return databaseDataSourceConnectionFactoryBean;
}
}
设置为合格的女式设置后,您应该在xml
中给您的表格全名<public.user id="1" created_date='2017-01-01 00:00:00' email="root@demo.io" password="your password" username="root"/>