use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class FilterBeanTest method testGetCurrentFilter.
@Test
public final void testGetCurrentFilter() throws NoSuchFieldException {
Filter expected = createMock(Filter.class);
setField(filterBean, "currentFilter", expected);
Filter actual = filterBean.getCurrentFilter();
assertSame(expected, actual);
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class FilterBeanTest method testSetCurrentFilter.
@Test
public final void testSetCurrentFilter() throws NoSuchFieldException {
Employee employee = new Employee("ownerName");
Project project = new Project();
project.setTeam(Collections.singletonList(employee));
List<Project> projects = Collections.singletonList(project);
Filter expected = new Filter();
expected.setName("filterName");
expected.setOwner("ownerName");
expected.setProjects(projects);
setField(filterBean, "currentFilter", new Filter());
EasyMock.expect(projectService.getProjectHierarchy(project)).andReturn(projects);
EasyMock.replay(filterService, projectService);
filterBean.setCurrentFilter(expected);
EasyMock.verify(filterService, projectService);
assertSame(expected, filterBean.getCurrentFilter());
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class FilterBeanTest method testSetCurrentFilter_CurrentFilterIsNotNull.
@Test
public void testSetCurrentFilter_CurrentFilterIsNotNull() throws NoSuchFieldException {
Employee employee = new Employee("ownerName");
Project project = new Project();
project.setTeam(Collections.singletonList(employee));
List<Project> projects = Collections.singletonList(project);
Filter currentFilter = new Filter();
currentFilter.setOwner("ownerName");
currentFilter.setProjects(projects);
setField(filterBean, "currentFilter", currentFilter);
Filter expected = new Filter();
expected.setOwner("ownerName");
expected.setProjects(projects);
EasyMock.expect(projectService.getProjectHierarchy(project)).andReturn(projects);
EasyMock.replay(filterService, projectService);
filterBean.setCurrentFilter(expected);
EasyMock.verify(filterService, projectService);
assertSame(expected, filterBean.getCurrentFilter());
assertSame(currentFilter.getRangePeriodSelector(), expected.getRangePeriodSelector());
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class FilterBeanTest method testGetProjects_SelectedCustomFilter_FilterContainsClosedProjects.
@Test
public void testGetProjects_SelectedCustomFilter_FilterContainsClosedProjects() throws NoSuchFieldException {
Project project1 = createProject(1L, null, "XXYY");
Project subproject1 = createProject(55L, null, "123");
Project project2 = createProject(2L, null, "AABB");
project2.setStatus(CLOSED);
project2.addManager(loggedEmployee);
List<Project> projects = asList(project1, subproject1);
List<Project> expected = asList(project1, subproject1, project2);
projects.forEach(project -> project.addManager(loggedEmployee));
Filter filter = new Filter();
filter.getProjects().add(project2);
setField(filterBean, "currentFilter", filter);
EasyMock.expect(projectService.getAll()).andReturn(projects);
EasyMock.expect(projectService.fetchComplete(projects)).andReturn(projects);
EasyMock.replay(projectService);
List<Project> actual = filterBean.getProjects();
EasyMock.verify(projectService);
ListAssert.assertEquals(expected, actual);
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class FilterBeanTest method testGetSelectedProjects.
@Test
public void testGetSelectedProjects() throws NoSuchFieldException {
Project project1 = createProject(1L, null, "project1");
project1.setStatus(FROZEN);
Project project2 = createProject(5L, null, "project2");
List<Project> expected = asList(project2, project1);
Filter filter = new Filter();
filter.setProjects(expected);
setField(filterBean, "currentFilter", filter);
EasyMock.expect(projectService.fetchComplete(anyObject(List.class))).andReturn(expected);
EasyMock.replay(projectService);
List<Project> actual = filterBean.getSelectedProjects();
EasyMock.verify(projectService);
ListAssert.assertEquals(expected, actual);
}
Aggregations