[英]dbunit dataset does not put boolean field into db
我使用 DbUnit 進行集成測試。 我有以下數據集。
<?xml version='1.0' encoding='UTF-8'?>
<dataset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="dataset.xsd">
<USERS ID="1" EMAIL="" LASTNAME="A" LASTMODIFIED="2001-01-01 00:00:00.0" />
<USERS ID="2" EMAIL="" LASTNAME="D" LASTMODIFIED="2001-01-01 00:00:00.0" ACTIVE="true" />
</dataset>
當我在測試中從數據庫加載時,boolean 字段 ACTIVE 未設置在第二個用戶上。
測試看起來像這樣:
@SpringApplicationContext("component-context-test-dao.xml")
@DataSet
public class UserDaoImplIT extends UnitilsJUnit4 {
@SpringBeanByType
private UserDaoImpl userDao;
@Test
public void shouldReturnTrueIfFoundActiveUserWithEmail() throws InterruptedException {
boolean exits = userDao.isEmailFromActiveUserInUsers("anEmailThatDoesNotExist@oeamtc.at");
List list = HibernateUnitils.getSession().createQuery("from User").list();
assertThat(exits, is(true));
}
}
我從 eclipse 中針對內存中的 h2 運行測試。
知道為什么除了 boolean 之外所有字段都被映射了嗎?
因為該值應該是TRUE
或FALSE
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.