Search in sources :

Example 1 with PhantomEmployeeDao

use of org.seasar.doma.it.dao.PhantomEmployeeDao in project doma by domaframework.

the class PrimitiveTypeTest method map_null_to_primitive_type.

@Test
void map_null_to_primitive_type(Config config) {
    PhantomEmployeeDao dao = new PhantomEmployeeDaoImpl(config);
    PhantomEmployee e = dao.selectById(9);
    byte managerId = e.getManagerId();
    assertEquals((byte) 0, managerId);
}
Also used : PhantomEmployee(org.seasar.doma.it.entity.PhantomEmployee) PhantomEmployeeDao(org.seasar.doma.it.dao.PhantomEmployeeDao) PhantomEmployeeDaoImpl(org.seasar.doma.it.dao.PhantomEmployeeDaoImpl) Test(org.junit.jupiter.api.Test)

Example 2 with PhantomEmployeeDao

use of org.seasar.doma.it.dao.PhantomEmployeeDao in project doma by domaframework.

the class PrimitiveTypeTest method select_primitive_types.

@Test
void select_primitive_types(Config config) {
    PhantomEmployeeDao dao = new PhantomEmployeeDaoImpl(config);
    Map<Integer, PhantomEmployee> map = dao.selectAll().stream().collect(Collectors.toMap(PhantomEmployee::getEmployeeId, Function.identity()));
    assertEquals(14, map.size());
    PhantomEmployee e = map.get(1);
    assertEquals(7369f, e.getEmployeeNo());
    assertEquals((byte) 13, e.getManagerId());
    assertEquals(800d, e.getSalary().getValue());
    assertEquals(2f, e.getDepartmentId());
    assertEquals(1d, e.getAddressId());
    assertEquals(1L, e.getVersion());
}
Also used : PhantomEmployee(org.seasar.doma.it.entity.PhantomEmployee) PhantomEmployeeDao(org.seasar.doma.it.dao.PhantomEmployeeDao) PhantomEmployeeDaoImpl(org.seasar.doma.it.dao.PhantomEmployeeDaoImpl) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)2 PhantomEmployeeDao (org.seasar.doma.it.dao.PhantomEmployeeDao)2 PhantomEmployeeDaoImpl (org.seasar.doma.it.dao.PhantomEmployeeDaoImpl)2 PhantomEmployee (org.seasar.doma.it.entity.PhantomEmployee)2