@Test public void givenEmployeeWithNoError_whenGetEmployee_employeeWithNoErrorIsReturned() { Employee first = new EmployeeTestBuilder().build(); MonthlyTaxForEmployee monthlyTax = new MonthlyTaxForEmployeeTestBuilder() .withEmployee(first) .build(); entityManager.persist(first); entityManager.persist(monthlyTax); entityManager.flush(); EmployeeTo employeeTo = presentationEmployeeRepository.getEmployee(first.getId()); assertThat(employeeTo.getErrorCount()).isEqualTo(0L); }
public EmployeeTo getEmployee(long id) { TypedQuery<EmployeeTo> employees = entityManager.createQuery(GET_EMPLOYEE_DETAIL_QUERY, EmployeeTo.class); employees.setParameter("id", id); return employees.getSingleResult(); }
PresentationEmployeeRepository { public EmployeeTo getEmployee(long id) { TypedQuery<EmployeeTo> employees = entityManager.createQuery(GET_EMPLOYEE_DETAIL_QUERY, EmployeeTo.class); employees.setParameter("id", id); return employees.getSingleResult(); } }
PresentationEmployeeRepository { public EmployeeTo getEmployee(long id) { TypedQuery<EmployeeTo> employees = entityManager.createQuery(GET_EMPLOYEE_DETAIL_QUERY, EmployeeTo.class); employees.setParameter("id", id); return employees.getSingleResult(); }  }
PresentationEmployeeRepository { public EmployeeTo getEmployee(long id) { TypedQuery<EmployeeTo> employees = entityManager.createQuery(GET_EMPLOYEE_DETAIL_QUERY, EmployeeTo.class); employees.setParameter("id", id); return employees.getSingleResult(); }  EmployeeTo getEmployee(long id); List<EmployeeTo> getEmployees(int page, int pageSize); long getEmployeeCount(); void setEntityManager(EntityManager entityManager); }
PresentationEmployeeRepository { public EmployeeTo getEmployee(long id) { TypedQuery<EmployeeTo> employees = entityManager.createQuery(GET_EMPLOYEE_DETAIL_QUERY, EmployeeTo.class); employees.setParameter("id", id); return employees.getSingleResult(); }  EmployeeTo getEmployee(long id); List<EmployeeTo> getEmployees(int page, int pageSize); long getEmployeeCount(); void setEntityManager(EntityManager entityManager); static final String GET_EMPLOYEE_COUNT_QUERY; static final String GET_EMPLOYEE_DETAIL_QUERY; static final String GET_EMPLOYEES_TOTAL_TAX_QUERY; }