use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.
the class EmployeeRepositoryTest method testGetEmployeesByDepartments_ifEmployeesDepartmentsAreEmpty.
@Test
public void testGetEmployeesByDepartments_ifEmployeesDepartmentsAreEmpty() {
Employee employee1 = new Employee("employee1");
employee1.setDepartment("department1");
Employee employee2 = new Employee("employee2");
employee2.setDepartment("department2");
Employee employee3 = new Employee("employee3");
employee3.setDepartment("department3");
Project project1 = new Project();
project1.addTeamMember(employee1);
project1.addTeamMember(employee2);
Project project2 = new Project();
project2.addTeamMember(employee1);
project2.addTeamMember(employee3);
Filter filter = new Filter();
filter.setEmployees(Collections.emptyList());
filter.setDepartments(Collections.emptyList());
entityManager.persist(project1);
entityManager.persist(project2);
entityManager.persist(employee1);
entityManager.persist(employee2);
entityManager.persist(employee3);
entityManager.flush();
List<Employee> expected = Arrays.asList(employee1, employee2, employee3);
List<Employee> actual = employeeRepository.getEmployeesByDepartments(filter);
ListAssert.assertEquals(expected, actual);
}
use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.
the class EmployeeRepositoryTest method testGetAll.
@Test
public void testGetAll() {
Employee employee1 = new Employee("employee1");
Employee employee2 = new Employee("employee2");
entityManager.persist(employee1);
entityManager.persist(employee2);
List<Employee> expected = Arrays.asList(employee1, employee2);
List<Employee> actual = employeeRepository.getAll();
ListAssert.assertEquals(expected, actual);
}
use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.
the class EmployeeRepositoryTest method testGetEmployeesByDepartments_ifEmployeesAreEmpty_FilterHasNotAllDepartments.
@Test
public void testGetEmployeesByDepartments_ifEmployeesAreEmpty_FilterHasNotAllDepartments() {
Employee employee1 = new Employee("employee1");
employee1.setDepartment("dep1");
Employee employee2 = new Employee("employee2");
employee2.setDepartment("dep2");
Employee employee3 = new Employee("employee3");
employee3.setDepartment("dep3");
Filter filter = new Filter();
filter.setEmployees(Arrays.asList(employee1, employee2));
filter.setDepartments(Arrays.asList("dep1", "dep2"));
entityManager.persist(employee1);
entityManager.persist(employee2);
entityManager.persist(employee3);
List<Employee> expected = filter.getEmployees();
List<Employee> actual = employeeRepository.getEmployeesByDepartments(filter);
ListAssert.assertEquals(expected, actual);
}
use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.
the class EmployeeRepositoryTest method testFind_ByUsername_EmployeeNotExist.
@Test
public void testFind_ByUsername_EmployeeNotExist() {
Employee unexpectedEmployee = new Employee("unexpected employee");
entityManager.persist(unexpectedEmployee);
Employee actual = employeeRepository.find("expected employee");
assertNull(actual);
}
use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.
the class EmployeeRepositoryTest method testPersisted.
@Test
public void testPersisted() {
Employee employee1 = new Employee("employee1");
Employee employee2 = new Employee("employee2");
entityManager.persist(employee1);
assertTrue(employeeRepository.persisted(employee1));
assertFalse(employeeRepository.persisted(employee2));
}
Aggregations