4

I use DbUnit for integration tests. I have the following dataset.

<?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>

Somehow the boolean field ACTIVE is not set on the second User when I load it from DB in my test.

The test looks like this:

@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));

}
}

I run the test from within eclipse against an in-memory h2.

Any ideas why all fields are mapped except the boolean one?

Faisal Feroz
  • 12,458
  • 4
  • 40
  • 51
nebenmir
  • 881
  • 2
  • 8
  • 16

1 Answers1

1

Because the value should be TRUE or FALSE

Datatypes - boolean type

Rangi Lin
  • 9,303
  • 6
  • 45
  • 71