MonthlyTaxForEmployeeRepository extends AbstractRepository<MonthlyTaxForEmployee> { public List<MonthlyTaxForEmployee> findByEmployee(Employee employee) { TypedQuery<MonthlyTaxForEmployee> typedQuery = entityManager.createNamedQuery(MonthlyTaxForEmployee.FIND_BY_EMPLOYEE, MonthlyTaxForEmployee.class); typedQuery.setParameter("employeeId", employee.getId()); return typedQuery.getResultList(); }  @Override @Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.DEFAULT) MonthlyTaxForEmployee save(MonthlyTaxForEmployee entity); List<MonthlyTaxForEmployee> findByEmployee(Employee employee); MonthlyTaxForEmployee find(Employee employee, int year, int month);  }
@Test public void testFindByEmployee() { setupSomeEmployeesAndMonthlyTaxes(); List<MonthlyTaxForEmployee> monthlyTaxForEmployees = monthlyTaxForEmployeeRepository.findByEmployee(ionel); assertThat(monthlyTaxForEmployees).containsOnly(ionelJanuary, ionelFebruary); }