use of org.seasar.doma.it.dao.EmployeeDaoImpl in project doma by domaframework.
the class SqlFileSelectStreamTest method testDomain_limitOffset.
@Test
public void testDomain_limitOffset(Config config) throws Exception {
EmployeeDao dao = new EmployeeDaoImpl(config);
BigDecimal total = dao.streamAllSalary(s -> s.filter(Objects::nonNull).reduce(BigDecimal.ZERO, (x, y) -> x.add(y)), SelectOptions.get().limit(5).offset(3));
assertTrue(new BigDecimal("6900").compareTo(total) == 0);
}
use of org.seasar.doma.it.dao.EmployeeDaoImpl in project doma by domaframework.
the class SqlFileSelectStreamTest method testMap_limitOffset.
@Test
public void testMap_limitOffset(Config config) throws Exception {
EmployeeDao dao = new EmployeeDaoImpl(config);
long count = dao.selectAllAsMapList(s -> s.count(), SelectOptions.get().limit(5).offset(3));
assertEquals(5L, count);
}
use of org.seasar.doma.it.dao.EmployeeDaoImpl in project doma by domaframework.
the class SqlFileSelectStreamTest method testStreamAll_resultStream.
@Test
public void testStreamAll_resultStream(Config config) throws Exception {
EmployeeDao dao = new EmployeeDaoImpl(config);
Long count = null;
try (Stream<Employee> stream = dao.streamAll()) {
count = stream.filter(e -> e.getEmployeeName() != null).filter(e -> e.getEmployeeName().startsWith("S")).count();
}
assertEquals(Long.valueOf(2), count);
}
use of org.seasar.doma.it.dao.EmployeeDaoImpl in project doma by domaframework.
the class SqlFileSelectStreamTest method testEntity_limitOffset.
@Test
public void testEntity_limitOffset(Config config) throws Exception {
EmployeeDao dao = new EmployeeDaoImpl(config);
long count = dao.streamAll(s -> s.count(), SelectOptions.get().limit(5).offset(3));
assertEquals(5L, count);
}
use of org.seasar.doma.it.dao.EmployeeDaoImpl in project doma by domaframework.
the class SqlFileSelectStreamTest method testMap.
@Test
public void testMap(Config config) throws Exception {
EmployeeDao dao = new EmployeeDaoImpl(config);
long count = dao.selectAllAsMapList(s -> s.count());
assertEquals(14L, count);
}
Aggregations