use of com.artezio.arttime.web.spread_sheet.SpreadSheet 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.web.spread_sheet.SpreadSheet in project ART-TIME by Artezio.
the class ManageEffortsBeanTest method testGetSpreadSheet_ifNotNull.
@Test
public void testGetSpreadSheet_ifNotNull() throws Exception {
SpreadSheet actual = manageEffortsBean.getSpreadSheet();
assertSame(spreadSheet, actual);
}
use of com.artezio.arttime.web.spread_sheet.SpreadSheet in project ART-TIME by Artezio.
the class ManageEffortsBeanTest method testShowMasterProjectTotalsLabel_ifGroupingByProject_AndNotShow.
@Test
public void testShowMasterProjectTotalsLabel_ifGroupingByProject_AndNotShow() throws NoSuchFieldException {
Project project = new Project();
Sheet sheet = createMock(Sheet.class);
SpreadSheet spreadSheet = createMock(SpreadSheet.class);
HeadSpreadSheetRow row1 = new HeadSpreadSheetRow(project);
HeadSpreadSheetRow row2 = new HeadSpreadSheetRow(project);
setField(manageEffortsBean, "grouping", BY_PROJECTS);
setField(project, "id", 1L);
setField(manageEffortsBean, "spreadSheet", spreadSheet);
expect(spreadSheet.getSheet()).andReturn(sheet);
expect(sheet.getRowIndex()).andReturn(1);
expect(spreadSheet.getRows()).andReturn(Arrays.asList(row1, row2));
replay(spreadSheet, sheet);
boolean actual = manageEffortsBean.showMasterProjectTotalsLabel(row2);
verify(spreadSheet, sheet);
assertFalse(actual);
}
use of com.artezio.arttime.web.spread_sheet.SpreadSheet in project ART-TIME by Artezio.
the class TimesheetBeanTest method testGetSpreadSheet_ifNull.
@Test
public void testGetSpreadSheet_ifNull() {
Filter currentFilter = createMock(Filter.class);
Filter personalTimesheetFilter = createMock(Filter.class);
expect(employeeService.getLoggedEmployee()).andReturn(Optional.of(new Employee()));
expect(filterService.getTimesheetFilter()).andReturn(personalTimesheetFilter);
expect(filterBean.getCurrentFilter()).andReturn(currentFilter);
replay(filterBean, filterService, employeeService);
SpreadSheet actual = bean.getSpreadSheet();
verify(filterBean, filterService, employeeService);
assertNotNull(actual);
}
Aggregations