use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class EmployeeRepositoryTest method testGetEmployeesByDepartments_ifDepartmentsAreEmpty.
@Test
public void testGetEmployeesByDepartments_ifDepartmentsAreEmpty() {
Employee employee1 = new Employee("employee1");
Employee employee2 = new Employee("employee2");
Employee employee3 = new Employee("employee3");
Filter filter = new Filter();
filter.setEmployees(Arrays.asList(employee1, employee2, employee3));
filter.setDepartments(Collections.emptyList());
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.filter.Filter in project ART-TIME by Artezio.
the class FilterRepositoryTest method testGetFiltersByOwner.
@Test
public void testGetFiltersByOwner() {
Employee employee = new Employee("user1");
Filter filter1 = createFilter("user1");
Filter filter2 = createFilter("user2");
entityManager.persist(filter1);
entityManager.persist(filter2);
List<Filter> expected = Arrays.asList(filter1);
List<Filter> actual = filterRepository.getFilters(employee);
ListAssert.assertEquals(expected, actual);
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class HoursRepositoryTest method testGetHours_FilterHasProjectsAndHasNoHourTypes.
@Test
public void testGetHours_FilterHasProjectsAndHasNoHourTypes() {
HourType hourType = new HourType("1");
List<HourType> hourTypes = Collections.singletonList(hourType);
Project project = new Project();
project.setAccountableHours(hourTypes);
Hours hour = new Hours(project, new Date(), null, hourType);
entityManager.persist(hourType);
entityManager.persist(project);
entityManager.persist(hour);
RangePeriodSelector rangePeriodSelector = new RangePeriodSelector(createPeriod(-1, 1));
Filter filter = new Filter();
filter.setRangePeriodSelector(rangePeriodSelector);
filter.setHourTypes(Collections.emptyList());
filter.setProjects(Collections.singletonList(project));
List<Hours> actual = hoursRepository.getHours(filter);
List<Hours> expected = Collections.singletonList(hour);
assertEquals(expected, actual);
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class HoursRepositoryTest method testGetHours_FilterHasNoProjectsAndHourTypes.
@Test
public void testGetHours_FilterHasNoProjectsAndHourTypes() {
Project project = new Project();
Hours hour = new Hours();
hour.setProject(project);
hour.setDate(new Date());
entityManager.persist(project);
entityManager.persist(hour);
RangePeriodSelector rangePeriodSelector = new RangePeriodSelector(createPeriod(-1, 1));
Filter filter = new Filter();
filter.setRangePeriodSelector(rangePeriodSelector);
filter.setHourTypes(Collections.emptyList());
filter.setProjects(Collections.emptyList());
List<Hours> actual = hoursRepository.getHours(filter);
List<Hours> expected = Collections.singletonList(hour);
assertEquals(expected, actual);
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class HoursRepositoryTest method testGetHours_FilterHasProjectsAndHourTypes.
@Test
public void testGetHours_FilterHasProjectsAndHourTypes() {
HourType hourType = new HourType("1");
List<HourType> hourTypes = Collections.singletonList(hourType);
Project project = new Project();
project.setAccountableHours(hourTypes);
Hours hour = new Hours(project, new Date(), null, hourType);
entityManager.persist(hourType);
entityManager.persist(project);
entityManager.persist(hour);
RangePeriodSelector rangePeriodSelector = new RangePeriodSelector(createPeriod(-1, 1));
Filter filter = new Filter();
filter.setRangePeriodSelector(rangePeriodSelector);
filter.setHourTypes(hourTypes);
filter.setProjects(Collections.singletonList(project));
List<Hours> actual = hoursRepository.getHours(filter);
List<Hours> expected = Collections.singletonList(hour);
assertEquals(expected, actual);
}
Aggregations