use of com.artezio.arttime.services.EmployeeService in project ART-TIME by Artezio.
the class FilterBeanTest method testGetEmployees.
@Test
public void testGetEmployees() throws NoSuchFieldException {
EmployeeService employeeService = mock(EmployeeService.class);
Employee currentEmployee = new Employee("current");
currentEmployee.setFormer(false);
Employee formerEmployee = new Employee("former");
formerEmployee.setFormer(true);
setField(filterBean, "employeeService", employeeService);
EasyMock.expect(employeeService.getAll()).andReturn(asList(currentEmployee, formerEmployee));
EasyMock.replay(employeeService);
List<Employee> actual = filterBean.getEmployees();
EasyMock.verify(employeeService);
assertTrue(actual.contains(currentEmployee));
assertFalse(actual.contains(formerEmployee));
}
use of com.artezio.arttime.services.EmployeeService in project ART-TIME by Artezio.
the class ManageEffortsBeanTest method testInitProjectEffortsSpreadSheet.
@Test
public void testInitProjectEffortsSpreadSheet() throws Exception {
manageEffortsBean = new ManageEffortsBean();
ProjectEffortsSpreadSheetBuildingStrategy strategy = createMock(ProjectEffortsSpreadSheetBuildingStrategy.class);
EmployeeService employeeService = mock(EmployeeService.class);
setField(strategy, "employeeService", employeeService);
Filter filter = createMock(Filter.class);
setField(manageEffortsBean, "grouping", BY_PROJECTS);
setField(manageEffortsBean, "filterBean", filterBean);
setField(manageEffortsBean, "employeeService", employeeService);
EasyMock.expect(filterService.getActiveProjectsFilter()).andReturn(filter);
EasyMock.expect(filterBean.getCurrentFilter()).andReturn(filter);
expect(employeeService.getEffortsEmployees()).andReturn(Collections.emptyList());
replay(employeeService, filterBean, strategy);
SpreadSheet actual = manageEffortsBean.initSpreadSheet();
verify(employeeService, filterBean, strategy);
assertEquals(ProjectEffortsSpreadSheet.class, actual.getClass());
}
use of com.artezio.arttime.services.EmployeeService in project ART-TIME by Artezio.
the class ManageEffortsBeanTest method testInitEmployeeEffortsSpreadSheet.
@Test
public void testInitEmployeeEffortsSpreadSheet() throws Exception {
manageEffortsBean = new ManageEffortsBean();
EmployeeService employeeService = mock(EmployeeService.class);
EmployeeEffortsSpreadSheetBuildingStrategy strategy = createMock(EmployeeEffortsSpreadSheetBuildingStrategy.class);
setField(strategy, "employeeService", employeeService);
Filter filter = createMock(Filter.class);
setField(manageEffortsBean, "grouping", BY_EMPLOYEES);
setField(manageEffortsBean, "filterBean", filterBean);
setField(manageEffortsBean, "employeeService", employeeService);
expect(employeeService.getEffortsEmployees()).andReturn(Collections.emptyList());
EasyMock.expect(filterBean.getCurrentFilter()).andReturn(filter);
replay(employeeService, filterBean, strategy);
SpreadSheet actual = manageEffortsBean.initSpreadSheet();
verify(employeeService, filterBean, strategy);
assertEquals(EmployeeEffortsSpreadSheet.class, actual.getClass());
}
use of com.artezio.arttime.services.EmployeeService in project ART-TIME by Artezio.
the class ReportedHoursIndicatorTest method setUp.
@Before
public void setUp() throws Exception {
loggedEmployee = new Employee(userName);
hoursIndicator = createMockBuilder(ReportedHoursIndicator.class).addMockedMethod("getFilter").createMock();
period = new Period();
workTimeService = createMock(WorkTimeService.class);
employeeService = createMock(EmployeeService.class);
filter = createMock(Filter.class);
hourTypeService = createMock(HourTypeService.class);
expect(employeeService.getLoggedEmployee()).andReturn(Optional.of(loggedEmployee)).anyTimes();
replay(employeeService);
setField(hoursIndicator, "workTimeService", workTimeService);
setField(hoursIndicator, "employeeService", employeeService);
setField(hoursIndicator, "hourTypeService", hourTypeService);
}
Aggregations