use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class FilterBeanTest method testGetProjects_SelectedCustomFilter_FilterContainsClosedProjectsWithSubprojects.
@Test
public void testGetProjects_SelectedCustomFilter_FilterContainsClosedProjectsWithSubprojects() throws NoSuchFieldException {
Project project1 = createProject(1L, null, "XXYY");
project1.setStatus(CLOSED);
project1.addManager(loggedEmployee);
Project subproject1 = createProject(55L, project1, "123");
subproject1.setStatus(CLOSED);
subproject1.addManager(loggedEmployee);
Project project2 = createProject(2L, null, "AABB");
project2.addManager(loggedEmployee);
List<Project> projects = asList(project2);
List<Project> expected = asList(project1, project2);
Filter filter = new Filter();
filter.setProjects(asList(project1, subproject1));
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 testRemove.
@Test
public void testRemove() throws NoSuchFieldException {
Filter filter = new Filter("filter", "user", false);
Filter currentFilter = new Filter("currentFilter", "user", false);
setField(filterBean, "currentFilter", currentFilter);
filterService.remove(filter);
EasyMock.replay(filterService);
filterBean.remove(filter);
EasyMock.verify(filterService);
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class FilterBeanTest method testGetSelectedProjects_OnlySubprojectAvailable.
@Test
public void testGetSelectedProjects_OnlySubprojectAvailable() throws NoSuchFieldException {
Project project1 = createProject(1L, null, "project1");
Project subproject = createProject(5L, project1, "subproject");
subproject.addManager(loggedEmployee);
List<Project> expected = asList(subproject);
Filter filter = new Filter();
filter.setProjects(expected);
setField(filterBean, "currentFilter", filter);
EasyMock.expect(projectService.fetchComplete(anyObject(List.class))).andReturn(expected);
expect(employeeService.getLoggedEmployee()).andReturn(Optional.of(loggedEmployee));
EasyMock.replay(projectService, employeeService);
List<Project> actual = filterBean.getSelectedProjects();
EasyMock.verify(projectService, employeeService);
ListAssert.assertEquals(expected, actual);
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class FilterBeanTest method testGetProjects_MasterAndSubprojectAvailable.
@Test
public void testGetProjects_MasterAndSubprojectAvailable() throws NoSuchFieldException {
Project project1 = createProject(1L, null, "XXYY");
Project subproject1 = createProject(55L, project1, "123");
Project project2 = createProject(2L, null, "AABB");
List<Project> projects = asList(project1, project2, subproject1);
List<Project> expected = asList(project1, project2);
projects.forEach(project -> project.addManager(loggedEmployee));
Filter filter = new Filter();
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_MasterAndSubprojectAvailable.
@Test
public void testGetSelectedProjects_MasterAndSubprojectAvailable() throws NoSuchFieldException {
Project project1 = createProject(1L, null, "project1");
Project subproject = createProject(5L, project1, "subproject");
project1.addManager(loggedEmployee);
subproject.addManager(loggedEmployee);
List<Project> expected = asList(project1);
Filter filter = new Filter();
filter.setProjects(asList(project1, subproject));
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