Search in sources :

Example 21 with EmployeeDaoImpl

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

the class SqlFileSelectStreamTest method testEntity.

@Test
public void testEntity(Config config) throws Exception {
    EmployeeDao dao = new EmployeeDaoImpl(config);
    long count = dao.streamAll(s -> s.count());
    assertEquals(14L, count);
}
Also used : EmployeeDao(org.seasar.doma.it.dao.EmployeeDao) EmployeeDaoImpl(org.seasar.doma.it.dao.EmployeeDaoImpl) Test(org.junit.jupiter.api.Test)

Example 22 with EmployeeDaoImpl

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

the class SqlFileSelectTest method testEnsureResultMappping_false.

@Test
public void testEnsureResultMappping_false(Config config) throws Exception {
    EmployeeDao dao = new EmployeeDaoImpl(config);
    List<Employee> employees = dao.selectOnlyNameWithoutMappingCheck();
    assertEquals(14, employees.size());
}
Also used : EmployeeDao(org.seasar.doma.it.dao.EmployeeDao) Employee(org.seasar.doma.it.entity.Employee) EmployeeDaoImpl(org.seasar.doma.it.dao.EmployeeDaoImpl) Test(org.junit.jupiter.api.Test)

Example 23 with EmployeeDaoImpl

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

the class SqlFileSelectTest method testNull.

@Test
public void testNull(Config config) throws Exception {
    EmployeeDao dao = new EmployeeDaoImpl(config);
    Employee employee = dao.selectById(9);
    assertNull(employee.getManagerId());
}
Also used : EmployeeDao(org.seasar.doma.it.dao.EmployeeDao) Employee(org.seasar.doma.it.entity.Employee) EmployeeDaoImpl(org.seasar.doma.it.dao.EmployeeDaoImpl) Test(org.junit.jupiter.api.Test)

Example 24 with EmployeeDaoImpl

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

the class SqlFileSelectTest method testMapList.

@Test
public void testMapList(Config config) throws Exception {
    EmployeeDao dao = new EmployeeDaoImpl(config);
    List<Map<String, Object>> employees = dao.selectAllAsMapList();
    assertEquals(14, employees.size());
}
Also used : EmployeeDao(org.seasar.doma.it.dao.EmployeeDao) Map(java.util.Map) EmployeeDaoImpl(org.seasar.doma.it.dao.EmployeeDaoImpl) Test(org.junit.jupiter.api.Test)

Example 25 with EmployeeDaoImpl

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

the class SqlFileSelectTest method testEnsureResultMappping_true.

@Test
public void testEnsureResultMappping_true(Config config) throws Exception {
    EmployeeDao dao = new EmployeeDaoImpl(config);
    try {
        dao.selectOnlyNameWithMappingCheck();
        fail();
    } catch (ResultMappingException expected) {
        System.err.print(expected);
    }
}
Also used : EmployeeDao(org.seasar.doma.it.dao.EmployeeDao) ResultMappingException(org.seasar.doma.jdbc.ResultMappingException) EmployeeDaoImpl(org.seasar.doma.it.dao.EmployeeDaoImpl) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)54 EmployeeDao (org.seasar.doma.it.dao.EmployeeDao)54 EmployeeDaoImpl (org.seasar.doma.it.dao.EmployeeDaoImpl)54 Employee (org.seasar.doma.it.entity.Employee)43 Run (org.seasar.doma.it.Run)8 CompKeyEmployeeDao (org.seasar.doma.it.dao.CompKeyEmployeeDao)8 CompKeyEmployeeDaoImpl (org.seasar.doma.it.dao.CompKeyEmployeeDaoImpl)8 CompKeyEmployee (org.seasar.doma.it.entity.CompKeyEmployee)8 SelectOptions (org.seasar.doma.jdbc.SelectOptions)8 BigDecimal (java.math.BigDecimal)6 Objects (java.util.Objects)4 Stream (java.util.stream.Stream)4 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)4 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)4 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)4 IntegrationTestEnvironment (org.seasar.doma.it.IntegrationTestEnvironment)4 Config (org.seasar.doma.jdbc.Config)4 HiredateImpl (org.seasar.doma.it.domain.HiredateImpl)2 OptimisticLockException (org.seasar.doma.jdbc.OptimisticLockException)2 List (java.util.List)1